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

你可能感兴趣的:(iOS,swift,ui,Swift链式调用开发UI界面)