Skip to content

Codable Layout Attributes #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Conversation

ZkHaider
Copy link

@ZkHaider ZkHaider commented Sep 22, 2019

Added Codable LayoutAttribute enum value types.

You can now encode / decode these attributes. Also added auxiliary to use these value types as well:

/// Value types

public enum LayoutAttribute {
    
    case fill(Fill)
    case hFill(HFill)
    case vFill(VFill)
    
    case center(Center)
    case hCenter(HCenter)
    case vCenter(VCenter)
    
    case alignTop(AlignTop)
    case alignStart(AlignStart)
    case alignBottom(AlignBottom)
    case alignEnd(AlignEnd)
    
    case unknown
    
}

view.lx.center(
     Center(start: 0.0, top: 0.0, end: 0.0, bottom: 0.0)
)
view.lx.fill(
    Fill(start: 0.0, top: 0.0, end: 0.0, bottom: 0.0)
)
view.lx.hFill(
    HCenter(start: 0.0, end: 0.0)
)
view.lx.vFill(
    VCenter(top: 0.0, bottom: 0.0)
)
// and so on.

@psharanda
Copy link
Owner

Oh wow, that's really interesting, need to take a deep look. I am really impressed how much effort you put into my lib

@psharanda
Copy link
Owner

I see you added new demo app. But I haven't found an example of usage new APIs inside of demo app? Is something supposed to be there?
What is the purpose of having attributes to conform Hashable?
Could you describe what is the goal to add serialization for layoutOps?

@psharanda
Copy link
Owner

I can imagine adding serialization to nodes concept. So we can load ui descriptions from web or from local files

@ZkHaider
Copy link
Author

ZkHaider commented Oct 13, 2019

Ah just coming back to this now @psharanda I'm utilizing LayoutOps to serialize layout info as a means of rendering view components using simple value types across different platforms. Will write a more thorough response and implementation details shortly! By the way love the work you've put into this framework 👍

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

Successfully merging this pull request may close these issues.

2 participants