Swiftpack.co -  feixue299/FXViewKit as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
feixue299/FXViewKit
快速构建常用的一些View
.package(url: "https://github.com/feixue299/FXViewKit.git", from: "0.2.2")

FXViewKit

Requirements

  • iOS 9.0+

Installation

CocoaPods

For FXViewKit, use the following entry in your Podfile:

pod 'FXViewKit', '~> 0.1.11'

Then run pod install.

Carthage

Make the following entry in your Cartfile:

github "feixue299/FXViewKit" ~>0.1.11

Then run carthage update.

Swift Package Manager

Create a Package.swift file.

let package = Package(
    dependencies: [
        .package(url: "https://github.com/feixue299/FXViewKit.git", from: "0.1.11")
    ],
    // ...
)

Example

import FXViewKit

class ViewController: UIViewController {

    let lrView = LeftRightView<UILabel, UIButton>()
    let tbView = TopBottomView<UILabel, UIButton>()
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        lrView.backgroundColor = .systemPink
        lrView.leftView.text = "left"
        lrView.leftView.backgroundColor = .systemBlue
        lrView.rightView.addTarget(self, action: #selector(lrViewTap), for: .touchUpInside)
        lrView.rightView.backgroundColor = .green
        lrView.rightView.setTitle("right", for: .normal)
        
        lrView.translatesAutoresizingMaskIntoConstraints = false
        
        view.addSubview(lrView)
        NSLayoutConstraint.activate([
            lrView.leftAnchor.constraint(equalTo: view.leftAnchor),
            lrView.centerYAnchor.constraint(equalTo: view.centerYAnchor),
            lrView.heightAnchor.constraint(equalToConstant: 44),
            lrView.rightAnchor.constraint(equalTo: view.rightAnchor)
        ])
        
        tbView.backgroundColor = .systemPink
        tbView.topView.text = "top"
        tbView.topView.backgroundColor = .systemBlue
        tbView.bottomView.addTarget(self, action: #selector(tbViewTap), for: .touchUpInside)
        tbView.bottomView.backgroundColor = .green
        tbView.bottomView.setTitle("bottom", for: .normal)
        
        tbView.translatesAutoresizingMaskIntoConstraints = false
        
        view.addSubview(tbView)
        NSLayoutConstraint.activate([
            tbView.topAnchor.constraint(equalTo: view.topAnchor),
            tbView.centerXAnchor.constraint(equalTo: view.centerXAnchor),
            tbView.widthAnchor.constraint(equalToConstant: 60),
            tbView.bottomAnchor.constraint(equalTo: lrView.topAnchor)
        ])
        
    }

    @objc func lrViewTap() {
        lrView.edges.top = CGFloat(arc4random() % 10)
        lrView.edges.left = CGFloat(arc4random() % 10)
        lrView.edges.right = CGFloat(arc4random() % 10)
        lrView.edges.bottom = CGFloat(arc4random() % 10)
    }
    
    @objc func tbViewTap() {
        tbView.edges.top = CGFloat(arc4random() % 10)
        tbView.edges.left = CGFloat(arc4random() % 10)
        tbView.edges.right = CGFloat(arc4random() % 10)
        tbView.edges.bottom = CGFloat(arc4random() % 10)
    }

}

GitHub

link
Stars: 0
Last commit: 2 days ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API