Contributions to ClampedPropertyWrapper are most welcome. Check out some of the issue templates for more info.
💻 Developing
Requirements
Xcode 12.5+ (Recommended)
📜 Generating Documentation
Documentation is generated by Swift Doc. Installation instructions can be found here, and as soon as you have it set up, docs can be generated simply by running ./Scripts/generate-html-docs.zsh from the command line.
📝 Note that this will only generate a .build/documentation folder for you to view locally. This folder is being ignored by git, and a GitHub action exists to automatically generate docs at the root level and serve them on the project’s gh-pages branch.
🏷 License
ClampedPropertyWrapper is available under the MIT license. See the LICENSE file for more info.
Clamped: A Swift Property Wrapper
A Swift Property Wrapper for automatically clamping Comparable values to closed or partial ranges.
Features
Comparable
type to aClosedRange
or a “Half-Open” range.FloatingPoint
properties with aPartialRangeThrough
,PartialRangeFrom
, orPartialRangeUpTo
expression.FloatingPoint
orFixedWidthInteger
properties with exclusive lower and upper bounds.Installation
Xcode Projects
Select
File
->Swift Packages
->Add Package Dependency
and enterhttps://github.com/CypherPoet/ClampedPropertyWrapper
.Swift Package Manager Projects
You can add
ClampedPropertyWrapper
as a package dependency in yourPackage.swift
file:From there, refer to
ClampedPropertyWrapper
as a “target dependency” in any of your package’s targets that need it.Then simply
import ClampedPropertyWrapper
wherever you’d like to use it.Usage
Basic Example:
You can also take things further in this project’s Xcode Playground:
Contributing
Contributions to
ClampedPropertyWrapper
are most welcome. Check out some of the issue templates for more info.💻 Developing
Requirements
📜 Generating Documentation
Documentation is generated by Swift Doc. Installation instructions can be found here, and as soon as you have it set up, docs can be generated simply by running
./Scripts/generate-html-docs.zsh
from the command line.📝 Note that this will only generate a
.build/documentation
folder for you to view locally. This folder is being ignored bygit
, and a GitHub action exists to automatically generate docs at the root level and serve them on the project’sgh-pages
branch.🏷 License
ClampedPropertyWrapper
is available under the MIT license. See the LICENSE file for more info.