Skip to content
This repository has been archived by the owner on Aug 1, 2019. It is now read-only.

[#143] images and text cell #146

Open
wants to merge 33 commits into
base: master
Choose a base branch
from

Conversation

dodikk
Copy link

@dodikk dodikk commented Jul 20, 2017

Solving #143

Alexander Dodatko added 30 commits April 24, 2017 11:02
TODO: maybe replace a struct with a protocol/delegate
* Added "symbolsCounterLabel"
* Unwrapped `checkCameraPermissions` and `checkPhotoLibraryPermissions`
as explicit boolean table with pattern matching
* Added `pickedImageAssets` delegate method for multiselection
@dodikk
Copy link
Author

dodikk commented Sep 20, 2017

A better implementation to avoid ugly inheritance

class VHMessageContentNode: ContentNode {
    
    public var textNode: ASTextNode?
    public var timestampNode: ASTextNode?
    public var attachmentsNode: CollectionViewContentNode?
    
    override func layoutSpecThatFits(_ constrainedSize: ASSizeRange) -> ASLayoutSpec {
        
        let children: [ASLayoutElement?] = [self.timestampNode,
                                            self.textNode,
                                            self.attachmentsNode]
        
        let stackSpec = ASStackLayoutSpec(direction: .vertical,
                                          spacing: 5,
                                          justifyContent: .start,
                                          alignItems: .start,
                                          children: children.flatMap { $0 })
        
        let insets = UIEdgeInsets(top: 10, left: 15, bottom: 10, right: 15)
        
        let insetSpec = ASInsetLayoutSpec(insets: insets,
                                          child: stackSpec)
        return insetSpec
    }
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant