LayoutOps icon indicating copy to clipboard operation
LayoutOps copied to clipboard

Codable Layout Attributes

Open ZkHaider opened this issue 6 years ago • 4 comments

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.

ZkHaider avatar Sep 22 '19 22:09 ZkHaider

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 avatar Sep 23 '19 14:09 psharanda

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 avatar Sep 27 '19 11:09 psharanda

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

psharanda avatar Sep 27 '19 11:09 psharanda

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 👍

ZkHaider avatar Oct 13 '19 19:10 ZkHaider