iOS开发Swift开发UI页面链式调用库推荐

首页链接

https://github.com/zhiguangqiao/ChainableUIKit

安装方法

复制代码
  pod 'ChainableUIKit'

调用片段

UIButton

复制代码
import ChainableUIKit

    private let button = UIButton().chain
        .setTitleColor(.init(hex: "#9583EB"), state: .normal)
        .setTitle("全部视频", state: .normal)
        .setTitleColor(.white, state: .selected)
        .fixSize(CGSizeMake(54, 32))
        .titleFont(.systemFont(ofSize: 12))
        .cornerRadius(4)
        .view

UILabel

复制代码
import ChainableUIKit

    private let videoNumber = UILabel()
        .chain
        .text("1")
        .textColor(.init(hex: "#141B26"))
        .font(.boldSystemFont(ofSize: 30))
        .view

UIStackView

复制代码
import ChainableUIKit

    private lazy var videoNumberStackView = UIStackView().chain
        .axis(.horizontal)
        .alignment(.center)
        .backgroundColor(.white)
        .arrangedViews([
            UILabel()
            .chain
            .text("video")
            .textColor(.init(hex: "#141B26"))
            .font(.boldSystemFont(ofSize: 10))
            .view
            ,videoNumber])
        .view

UITextField

复制代码
import ChainableUIKit

    private let scoreTF = UITextField()
        .chain
        .backgroundColor(.init(hex: "#FFE3A6"))
        .textAlignment(.center)
        .keyboardType(.numberPad)
        .textColor(.init(hex: "#141B26"))
        .view
相关推荐
HarderCoder1 天前
Swift 6 并发时代,如何优雅地“抢救”你的单例?
swift
zhangmeng1 天前
FlutterBoost在iOS26真机运行崩溃问题
flutter·app·swift
HarderCoder1 天前
SwiftUI 踩坑记:onAppear / task 不回调?90% 撞上了“空壳视图”!
swift
HarderCoder1 天前
@isolated(any) 深度解析:Swift 并发中的“隔离追踪器”
swift
大熊猫侯佩1 天前
桃花岛 Xcode 构建秘籍:Swift 中的 “Feature Flags” 心法
app·xcode·swift
用户091 天前
SwiftUI Charts 函数绘图完全指南
ios·swiftui·swift
YungFan1 天前
iOS26适配指南之UIColor
ios·swift
HarderCoder1 天前
Swift 6.2 新特性 `@concurrent` 完全导读
swift
HarderCoder1 天前
Swift 里的“橡皮擦”与“标签”——搞懂 existentials 与 primary associated type
swift
用户092 天前
TipKit与CloudKit同步完全指南
ios·swift