mvdmakesthings / constrain

:rocket: Collection of useful swift property wrappers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Constrain Library

Collection of useful property wrappers

Property Wrappers

Constrained

Clamps value to a range

@Constrained(0...14) var pH: Int

UnitInterval

Clamps value to a range from 0 to 1

@UnitInterval var volume: Double

Formatted

Formats a value with closure

@Formatted({ $0 + 1 }) var increment: Int

Trimmed

Trims whitespace and new lines from string

@Trimmed var string: String

Uppercased

Forcing uppercased string

@Uppercased var name: String

Lowercased

Forcing lowercased string

@Lowercased var name: String

Capitalized

Formats a string to be capitalized

@Capitalized var name: String

Requirements

  • Swift 5+

Roadmap

  • More string formatters
  • Composition
  • Codable propertyWrappers

Contibutions

Feel free to contribute via fork/pull request to master branch. If you want to request a feature or report a bug please start a new issue.

About

:rocket: Collection of useful swift property wrappers

License:MIT License


Languages

Language:Swift 100.0%