GaikaniOS 样式

联合创作 · 2023-09-27

Gaikan 是 Swift 中的一个 DSL 声明 ,提供了强大的样式功能。它是参照 JS 和 CSS 模块中的 CSS 创建出来的。

提供一个 Style 对象来设计 UIView(s) 。

let myLabelStyle: Style = [  .Color: UIColor.redColor(),  .Border: Border(width: 1, color: UIColor.greenColor()),  .Font: UIFont(name: "Courier", size: 24),        
]/// ORlet myLabelStyle = StyleRule() { (inout style: StyleRule) -> () in
  style.color = UIColor.redColor()
  style.border = Border(width: 1, color: UIColor.greenColor())
  style.font = UIFont(name: "Courier", size: 24)
}self.label.applyStyle(myLabelStyle)

可查看样品来了解如何将 Gaikan 集成到一个项目中。

浏览 4
点赞
评论
收藏
分享

手机扫一扫分享

编辑
举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

编辑
举报