Releases: ArtSabintsev/Guitar
Changes to accommodate Swift 4.1
Minor changes in a few places to make the library Swift 4.1 compatible.
Fixed Warnings and Updated Podspec
- Fixed
.characters
reference warning. - Updated Podspec file.
- Removed
.swift-version
file, as it's been deprecated.
Support for Swift 4 / iOS 11 / Xcode 9
Siren v0.3.0 adds support for Swift 4 / iOS 11 / Xcode 9.
A small set of functions offered by Guitar were removed in this version as Apple added many of these features to the Swift 4 language. The functions that were removed were: first, last, length, prefixed, suffixed, trimLeft, trimRight, truncated
. The reversed
function was renamed to reversedString
as it acts slightly differently than Swift's built-in reversed function.
Moving forward, only support for the Swift 4 codebase (on master) will be maintained.
Swift Version | Branch Name | Will Continue to Receive Updates? |
---|---|---|
4.0 | master | Yes |
3.2 | swift3.2 | No |
3.1 | swift3.1 | No |
Swift PM Improvements
- Tests moved to
Tests/
folder in root directory - Added support for Linux Tests.
- Invoked
#availability
and#if os()
checks where necessary.
Beta Release!
As of v0.1.0, Guitar has transitioned from alpha to beta.
The existing API has stabilized and tests have been written for each public method and extension. Documentation has also been updated. To move from beta to a 1.0.0 release, more real-world testing is needed.
Please leave issues and PRs with any missing features or bugs!
Thanks!
Arthur
Latinization function
#16
Adds a latinization function (thanks to @EthanSchatzline)
func testLatinized() {
XCTAssertEqual("Hello! こんにちは! สวัสดี! مرحبا! 您好!".latinized(), "Hello! kon'nichiha! swasdi! mrhba! nin hao!")
XCTAssertEqual("как прекрасен этот мир".latinized(), "kak prekrasen etot mir")
XCTAssertEqual("你叫(做)乜野名呀?".latinized(), "ni jiao (zuo) mie ye ming ya?")
XCTAssertEqual("어떻게 지내세요?".latinized(), "eotteohge jinaeseyo?")
XCTAssertEqual("What a wonderful world! That's not cliché at all!".latinized(), "What a wonderful world! That's not cliche at all!")
}
Latinization Function
- @EthanSchatzline added the implementation and tests for
withoutAccents()
, which removes diacritics (e.g., accent marks) from latin characters. This is sometime referred to as latinization.
Guitar.Chord
Chord is now an enum within the Guitar class, which is turning more into a Regex handling class.
Kebab Case and Slug Case
Renamed slugCased function. Renamed it to kebabCased.
Removed kebabCased's old functionality as it was useless.
splitWordsByCase() Function
In #12, I added a new splitWordsByCase()
function that is able to create a string with whitespace-delimited words from any other case; camelCased, -kebab-cased-, PascalCase, snake_case, slug-case.
A few examples from the tests:
func testCaseMorphing() {
let string = "Hello World"
XCTAssertEqual(string.camelCased().kebabCased(), "-hello-world-")
XCTAssertEqual(string.camelCased().pascalCased(), "HelloWorld")
XCTAssertEqual(string.camelCased().slugCased(), "hello-world")
XCTAssertEqual(string.camelCased().snakeCased(), "hello_world")
XCTAssertEqual(string.kebabCased().camelCased(), "helloWorld")
XCTAssertEqual(string.kebabCased().pascalCased(), "HelloWorld")
XCTAssertEqual(string.kebabCased().slugCased(), "hello-world")
XCTAssertEqual(string.kebabCased().snakeCased(), "hello_world")
XCTAssertEqual(string.pascalCased().camelCased(), "helloWorld")
XCTAssertEqual(string.pascalCased().kebabCased(), "-hello-world-")
XCTAssertEqual(string.pascalCased().slugCased(), "hello-world")
XCTAssertEqual(string.pascalCased().snakeCased(), "hello_world")
XCTAssertEqual(string.slugCased().camelCased(), "helloWorld")
XCTAssertEqual(string.slugCased().kebabCased(), "-hello-world-")
XCTAssertEqual(string.slugCased().pascalCased(), "HelloWorld")
XCTAssertEqual(string.slugCased().snakeCased(), "hello_world")
XCTAssertEqual(string.snakeCased().camelCased(), "helloWorld")
XCTAssertEqual(string.snakeCased().kebabCased(), "-hello-world-")
XCTAssertEqual(string.snakeCased().pascalCased(), "HelloWorld")
XCTAssertEqual(string.snakeCased().slugCased(), "hello-world")
}