Adjust documentation
This commit is contained in:
parent
d0aa08edf2
commit
12d9cc5758
|
@ -1,4 +1,4 @@
|
|||
// swift-tools-version:5.5
|
||||
// swift-tools-version:5.6
|
||||
|
||||
import PackageDescription
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<p align="center">
|
||||
<img src ="Resources/Logo.png" width=500 />
|
||||
<img src ="Resources/Logo.png" width=500 alt="SwiftKit Logo" title="SwiftKit" />
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<img src="https://img.shields.io/github/v/release/danielsaidi/SwiftKit?color=%2300550&sort=semver" alt="Version" />
|
||||
<img src="https://img.shields.io/badge/platform-SwiftUI-red.svg" alt="Swift UI" />
|
||||
<img src="https://img.shields.io/badge/Swift-5.3-orange.svg" alt="Swift 5.3" />
|
||||
<img src="https://img.shields.io/badge/Swift-5.6-orange.svg" alt="Swift 5.6" />
|
||||
<img src="https://img.shields.io/github/license/danielsaidi/SwiftKit" alt="MIT License" />
|
||||
<a href="https://twitter.com/danielsaidi">
|
||||
<img src="https://img.shields.io/badge/contact-@danielsaidi-blue.svg?style=flat" alt="Twitter: @danielsaidi" />
|
||||
|
@ -15,7 +15,7 @@
|
|||
|
||||
## About SwiftKit
|
||||
|
||||
SwiftKit adds extra functionality to the Swift framework, like extensions to already existing types as well as completely new utilities, services, etc.
|
||||
SwiftKit adds extra functionality to the Swift programming language, like extensions to already existing types as well as completely new utilites, services, etc.
|
||||
|
||||
You can explore the various sections in the [documentation][Documentation] and the demo app.
|
||||
|
||||
|
|
|
@ -13,8 +13,8 @@ import Foundation
|
|||
to user defaults and sets the initial property value to the
|
||||
last persisted value or a fallback value.
|
||||
|
||||
This type is internal, since the `SwiftUI` instance is used
|
||||
to greated extent.
|
||||
This type is internal, since the `SwiftUI` tyope is used in
|
||||
more ways. This type only serves the library functionality.
|
||||
*/
|
||||
@propertyWrapper
|
||||
struct Persisted<T: Codable> {
|
||||
|
|
|
@ -10,19 +10,24 @@ import Foundation
|
|||
|
||||
public extension String {
|
||||
|
||||
private static let allowedCharacters = NSCharacterSet(charactersIn: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-")
|
||||
|
||||
/**
|
||||
Convert the string to a slugified version that works to
|
||||
be used as a tag.
|
||||
|
||||
|
||||
For instance, `I'd love an AppleCar!` will be converted
|
||||
to "i-d-love-an-apple-car".
|
||||
|
||||
- Parameters:
|
||||
- separator: The separator to use in the slugified string, by default `-`.
|
||||
- allowedCharacters: The characters to allow in the slugified string, by default alphanumerical characters and `-`.
|
||||
*/
|
||||
func slugified() -> String {
|
||||
func slugified(
|
||||
separator: String = "-",
|
||||
allowedCharacters: NSCharacterSet = NSCharacterSet(charactersIn: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-")
|
||||
) -> String {
|
||||
self.lowercased()
|
||||
.components(separatedBy: String.allowedCharacters.inverted)
|
||||
.filter { $0 != "" }
|
||||
.joined(separator: "-")
|
||||
.components(separatedBy: allowedCharacters.inverted)
|
||||
.filter { !$0.isEmpty }
|
||||
.joined(separator: separator)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue