
A Set of utilities to ease basic and repetitive tasks, in Swift.
Overview
This repository is an Xcode project with a set of ambidextrous (That’s what I really mean by “generic”; not just using generics) tools that can be applied to Swift projects deployed for iOS, iPadOS, MacOS, WatchOS and TVOS.
These tools will work for all of these platforms, and will, at most, rely only on the Foundation library, and the Core Graphics types (in the Core Foundation Library).
Usage
You can use SPM to load the project as a dependency, by referencing its GitHub Repo URI (SSH: git@github.com:RiftValleySoftware/RVS_Generic_Swift_Toolbox.git, or HTTPS: https://github.com/RiftValleySoftware/RVS_Generic_Swift_Toolbox.git).
Once you have the dependency attached, you reference it by adding an import to the files that consume the package:
import RVS_Generic_Swift_Toolbox
All of the extensions and utilities will be available.
Carthage is probably the “lowest-overhead” way to use these tools. It’s extremely simple to use, and squeaky clean. You will only need to include references to the files into your project.
You implement it by adding the following line in your Cartfile:
`github "RiftValleySoftware/RVS_Generic_Swift_Toolbox"`
Once you have done this, navigate the Terminal to the directory containing the Cartfile, and execute:
`carthage update`
This will result in a directory, at the same level as the Cartfile, called Carthage
. Inside of that directory, will be another directory, called Checkouts
. Inside of that directory, will be a directory called RVS_Generic_Swift_Toolbox
.
The files that you are looking for will be in the Sources/RVS_Generic_Swift_Toolbox
directory. They are arranged in the grouping they are documented, above.
Just drag those files into your Xcode project, and add them to the appropriate targets.
If you choose to use the build products, be aware that Carthage builds may not always sign the modules, so you could have issues submitting to the app store.
You could also directly include the project as a Git Submodule. Submodules can be annoying to work with, but are a good way to maintain ironclad version integrity.
If you do this, then you should do the same as above, but instead of a Carthage directory, you will have whatever directory you choose to use to place the submodule.
Requirements
These utilities require the Swift programming language, along with the Foundation Library (it also uses the Core Foundation Library, which, for some reason, is treated separately, in iOS).
NOTE: Because of the intricacies of accessing the main bundle, in XCTest
, the localizedVariant
and accessibilityLocalizedVariant
computed properties are not covered in the auto-test. This is OK, as they are used by every project I write, so they receive a lot of testing.
License
© Copyright 2019-2022, The Great Rift Valley Software Company
MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy,
modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
RVS_Generic_Swift_Toolbox
A Set of utilities to ease basic and repetitive tasks, in Swift.
Overview
This repository is an Xcode project with a set of ambidextrous (That’s what I really mean by “generic”; not just using generics) tools that can be applied to Swift projects deployed for iOS, iPadOS, MacOS, WatchOS and TVOS.
These tools will work for all of these platforms, and will, at most, rely only on the Foundation library, and the Core Graphics types (in the Core Foundation Library).
Here is the technical documentation for this repository
Here is the repository on GitHub
COLLECTION TOOLS
RVS_FIFOQueue
This is a high-performance generic FIFO queue data structure. It’s based on the work of Ole Begemann, who used it as an example in his Advanced Swift book.
RVS_SequenceProtocol
This is a simple protocol that gives classes and structs that conform to it, some basic Sequence behavior.
DEBUG TOOLS
EXTENSIONS
RVS_Number_Extensions
Extensions to integer data types, as well as some degree/radian conversion for floats and doubles.
RVS_Bundle_Extensions
Extensions to the Foundation Bundle.
RVS_String_Extensions
Extensions to the StringProtocol protocol. These are mostly parsing, filtering, and conversion capabilities.
RVS_Foundation_Extensions
Extensions to the StringProtocol protocol. This adds some significant capabilities, such as MD5/SHA-hashing, substring searching, simple localization, and basic parsing.
Extensions to the Date Struct. This makes Dates strideable. It also allows “coarse” date comparisons, using a “granularity” of 24 hours (one day).
Adds degree/radian conversion to CGFloat.
Adds rotation support to CGPoint.
Usage
Swift Package Manager (SPM)
You can use SPM to load the project as a dependency, by referencing its GitHub Repo URI (SSH: git@github.com:RiftValleySoftware/RVS_Generic_Swift_Toolbox.git, or HTTPS: https://github.com/RiftValleySoftware/RVS_Generic_Swift_Toolbox.git).
Once you have the dependency attached, you reference it by adding an import to the files that consume the package:
All of the extensions and utilities will be available.
Carthage
Carthage is probably the “lowest-overhead” way to use these tools. It’s extremely simple to use, and squeaky clean. You will only need to include references to the files into your project. You implement it by adding the following line in your Cartfile:
Once you have done this, navigate the Terminal to the directory containing the Cartfile, and execute:
This will result in a directory, at the same level as the Cartfile, called
Carthage
. Inside of that directory, will be another directory, calledCheckouts
. Inside of that directory, will be a directory calledRVS_Generic_Swift_Toolbox
. The files that you are looking for will be in theSources/RVS_Generic_Swift_Toolbox
directory. They are arranged in the grouping they are documented, above.Just drag those files into your Xcode project, and add them to the appropriate targets.
If you choose to use the build products, be aware that Carthage builds may not always sign the modules, so you could have issues submitting to the app store.
Git Submodule
You could also directly include the project as a Git Submodule. Submodules can be annoying to work with, but are a good way to maintain ironclad version integrity. If you do this, then you should do the same as above, but instead of a Carthage directory, you will have whatever directory you choose to use to place the submodule.
Requirements
These utilities require the Swift programming language, along with the Foundation Library (it also uses the Core Foundation Library, which, for some reason, is treated separately, in iOS).
License
© Copyright 2019-2022, The Great Rift Valley Software Company
MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.