Swiftpack.co - LudvigSahlin/Trifles as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by LudvigSahlin.
LudvigSahlin/Trifles 0.1.0
Packed with small useful extension functions
⭐️ 0
🕓 2 years ago
iOS
.package(url: "https://github.com/LudvigSahlin/Trifles.git", from: "0.1.0")

Trifles

This package is packed with small useful extension functions. It also contains helper functions defined in Trifles.swift.

Extension functions

Array:

  • isNeitherNilNorEmpty

Date:

  • todayMidnight
  • tomorrowMidnight
  • yesterdayMidnight

Optional:

  • isNeitherNilNorEmpty

UIView:

  • applyBorders
  • applyShadow
  • applyCardTraits

UIViewController:

  • dismissKeyboardOnTap

Other helper functions

Trifles:

  • TextField.build // Adds subviews and sets basic styling. Sets no constraints.
  • Button.build // Adds subviews and sets basic styling. Sets no constraints.

Usage:

Most functions should be self explanatory. Here are two examples:

let (containerView, backgroundView, label) = Trifles.Button.build()
containerView.applyBorders()

And if the keyboard should be dismissed when tapping:

override func viewDidLoad() {
    super.viewDidLoad()
    dismissKeyboardOnTap()
}

License

The contents of this repository is licensed under the Apache License, version 2.0.

Contact

[email protected]

GitHub

link
Stars: 0
Last commit: 2 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

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