Swiftpack.co -  jamalalayq/Viewity as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
jamalalayq/Viewity
Created to simplify constraints anchors and add some common code i use it.
.package(url: "https://github.com/jamalalayq/Viewity.git", from: "2.10.0")

Viewity

Created to simplify constraints anchors and add some common code. Use declarative syntax to build view via code.

Dynamic framework to share it with another targets.

Components

Common views attributes use it as a functions.

Button class with on tap function to handle user tapping.

Label with new insets attribute to add padding.

Text views, Stack views, Buttons, Labels, Views, Text fields, Image views, Table views and Collections views.

Installation

Copy Github link and add it as a Swift Package Manager library.

Usage

import UIKit
import Viewity

class ViewController: UIViewController {
    let button = Button(frame: .zero)

    override func viewDidLoad() {
        super.viewDidLoad()
        view.add(button)
        button.text("Tap Me!")
              .foreground(.white)
              .tint(.white)
              .onTap { [unowned button] in
                button.loadable(true)
                print(#function)
                DispatchQueue.main.asyncAfter(deadline: .now() + .seconds(3)) {
                    button.loadable(false)
                }
        }

        button.putInCenter()
        let gradient = LinearGradient(
            frame: .init(
                origin: .zero,
                size: .init(
                    width: button.intrinsicContentSize.width,
                    height: button.intrinsicContentSize.height
                )
            ),
            colors: [.systemGreen, .systemBlue]
        )
        button.gradient(of: gradient)
    }

    override func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(animated)
        self.view.background(.white, animated: true)
    }
}

GitHub

link
Stars: 1
Last commit: 2 weeks 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.

Release Notes

UIEdgeInsets
2 weeks ago

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