主题式Swift开发工具包
包含颜色、字体、布局等,可配置可缓存

特性

可缓存的

可配置的

提供便利

导入

1
pod 'Inspire'

用法示例

颜色

1
2
view.backgroundColor = .background
view.tintColor = .accent

字体

1
2
3
4
let lb = UILabel()
lb.font = .regular(15)
lb.font = .bold(20, for: .title)
lb.font = .regular(14, for: .code)

边距

1
2
3
4
let topMargin = layout.topBarHeight(for: self)
let bottomMargin = layout.bottomBarHeight(for: self)
let safeArea = layout.safeAreaInsets(for: self)
let safeArea2 = Inspire.shared.screen.safeAreaInsets
1
2
3
let layout = Inspire.shared.layout
view.frame.size.height = layout.rowHeight
view.layer.cornerRadius = layout.cornerRadius.large

缓存

1
2
3
4
5
// 保存
Inspire.shared.cache()
Inspire.shared.cache(named: "myTheme")
// 读取
let ipr = Inspire.init("myTheme")



评论