Dima Pilipenko

6个Pods
NSAttributedStyle和NSParagraphStyle的Swift版适配
```swift let attributedStyle = AttributedStyle().font(UIFont.systemFont(ofSize: 21, weight: UIFontWeightLight)) let parapraphStyle = ParagraphStyle().lineBreakMode(.byTruncatingMiddle) let attributes = attributedStyle.paragraphStyle(parapraphStyle.style).foregroundColor(.gray).attributes
let label = UILabel() label.attributedText = NSAttributedString(string: "Attribute it!", attributes: attributes) // 或 label.attributedText = NSAttributedString(string: "Attribute it!", attributes: AttributedStyle().font(UIFont.systemFont(ofSize: 21, weight: UIFontWeightLight)).foregroundColor(UIColor.darkGray).paragraphStyle(ParagraphStyle().alignment(.center).style).attributes) ```
许可证: MIT
Swift通用集合视图控制器库,具有外部数据处理功能,例如确定与indexPath相关联的cell的reuseIdentifier,对请求的cell进行配置和cell选择处理等
许可证: MIT
具有外部数据处理功能的通用表格视图控制器,例如确定与indexPath相关联的cell的reuseIdentifier,对请求的cell进行配置和cell选择处理等
许可证: MIT
创建具有特定Style
的Decorator
并将其链接到所需字符串的末尾或包装以进行样式化
swift "Style" + d1 + "Decorator" + d2 + "!" // 或 d1.wrap("Style") + d2.wrap("Decorator") + "!"
示例:```swift let a = Decorator(style: Style().foregroundColor(.black).kerning(-0.5).backgroundColor(.darkGray)) let b = Decorator(style: Style().foregroundColor(.white)) let c = Decorator(style: Style().foregroundColor(.gray).alignment(.right))
// 使用您喜欢的语法写入 let decoratedText = "Bold" + a + "Heavy" + b + "Black" + c label.attributedText = NSAttributedString(decorator: decoratedText)
// 或 let a1 = a.wrap, b1 = b.wrap, c1 = c.wrap let decoratedText2 = a1("Bold") + b1("Heavy") + c1("Black") label.attributedText = NSAttributedString(decorator: decoratedText2) ```
可以动态设计字符串:```swift // 请查看示例中的详细代码,其中创建了'd', 'e', 'f'等
let titleText = "! " + ("Bold" + b + "Heavy" + c + "Black" + d) let decoratedText = "简单地装饰属性字符串" + a + "
" + titleText + "
" + "右下方的黑色矩形以及红色的线" + f + "
具有默认属性"
let defaultAttributes = Style() .font(UIFont.systemFont(ofSize: 15, weight: UIFontWeightBlack)) .alignment(.center) .attributes
label.attributedText = NSAttributedString(decorator: decoratedText, attributes: defaultAttributes) ```
许可证: MIT
通过简单的方式构建教程/描述/信息屏幕。设置视觉资产并使用页面代理灵活。将特殊视图或控件放置在顶部子视图上,该子视图不会滚动。
```swift _wizardVC = WizardViewController() _wizardVC.modalTransitionStyle = .coverVertical _wizardVC.modalPresentationStyle = .overCurrentContext
// 设置页面指示器 _wizardVC.pageIndicatorColors = {[unowned self] currentPageIndex in let value: UIColor
if let color = self._wizardVC.getView(index: currentPageIndex)?.backgroundColor {
var r: CGFloat = 0, g: CGFloat = 0, b: CGFloat = 0, a: CGFloat = 0
color.getRed(&r, green: &g, blue: &b, alpha: &a)
// inverse color
value = UIColor(red: 1-r, green: 1-g, blue: 1-b, alpha: 1)
}
else {
switch currentPageIndex {
case 1: value = .darkGray
case 2: value = .gray
default: value = .black
}
}
return (nil, value)
}
// 设置视图 _wizardVC.setViews([B(), B(), B()])
// 或
// 设置视图控制器 _wizardVC.setViewControllers([A(), A(), A(), A()])
// 在顶部子视图上设置自定义视图 let button = UIButton(type: .custom) button.setTitle("跳过", for: .normal) button.sizeToFit() button.frame.origin.y = view.bounds.height - button.bounds.height - 50 button.frame.size.width = view.bounds.width button.addTarget(self, action: #selector(closeTutorial), for: .touchUpInside)
_wizardVC.setTop(view: button) ```
许可证: MIT