Remove slugified string extension
This commit is contained in:
parent
97c265f431
commit
66589c6ccb
|
@ -86,5 +86,4 @@ SwiftKit is available under the MIT license. See [LICENSE][License] file for mor
|
|||
[Sponsors]: https://github.com/sponsors/danielsaidi
|
||||
|
||||
[Documentation]: https://danielsaidi.github.io/SwiftKit/documentation/swiftkit/
|
||||
[Getting-Started]: https://danielsaidi.github.io/SwiftKit/documentation/swiftkit/getting-started
|
||||
[License]: https://github.com/danielsaidi/SwiftKit/blob/master/LICENSE
|
||||
|
|
|
@ -1,6 +1,16 @@
|
|||
# Release notes
|
||||
|
||||
|
||||
## 1.4
|
||||
|
||||
This version adjusts the library for Xcode 14 and deprecates some things.
|
||||
|
||||
### 💥 Breaking changes
|
||||
|
||||
* Due to conflicting with TagKit, `String+Slugifies` has been removed.
|
||||
|
||||
|
||||
|
||||
## 1.3
|
||||
|
||||
This version adjusts the library for Xcode 14 and deprecates some things.
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
//
|
||||
// String+Slugified.swift
|
||||
// SwiftKit
|
||||
//
|
||||
// Created by Daniel Saidi on 2021-04-22.
|
||||
// Copyright © 2021 Daniel Saidi. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
public extension String {
|
||||
|
||||
/**
|
||||
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 `-`.
|
||||
*/
|
||||
@available(*, deprecated, message: "This extension has moved to https://github.com/danielsaidi/TagKit")
|
||||
func slugified(
|
||||
separator: String = "-",
|
||||
allowedCharacters: NSCharacterSet = NSCharacterSet(charactersIn: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-")
|
||||
) -> String {
|
||||
self.lowercased()
|
||||
.components(separatedBy: allowedCharacters.inverted)
|
||||
.filter { !$0.isEmpty }
|
||||
.joined(separator: separator)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue