Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: objective-c
osx_image: xcode8.3
osx_image: xcode10.2
rvm:
- 2.1.0
- 2.3
script: ./.test.sh # easy to run on your machine : ./.test.sh
before_install: sudo gem install slather xcpretty
after_success: slather
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ String extension to validate an email address

### Removed

## [1.5.0](https://github.com/openium/SwiftiumKit/compare/v1.4.0...v1.5.0)
### Added
- Swift 5 compatibility

### Changed

### Removed

## [1.4.0] (https://github.com/openium/SwiftiumKit/compare/v1.3.0...v1.4.0)- 2016-11-08
### Added
Expand Down
12 changes: 6 additions & 6 deletions SwiftiumKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -283,11 +283,11 @@
BA8961D61C8EDBB100305CB0 = {
CreatedOnToolsVersion = 7.2;
DevelopmentTeam = QH6KR5PAQ7;
LastSwiftMigration = 0800;
LastSwiftMigration = 1010;
};
BA8961E01C8EDBB100305CB0 = {
CreatedOnToolsVersion = 7.2;
LastSwiftMigration = 0800;
LastSwiftMigration = 1010;
};
};
};
Expand Down Expand Up @@ -479,7 +479,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
Expand All @@ -500,7 +500,7 @@
PRODUCT_BUNDLE_IDENTIFIER = fr.openium.SwiftiumKit;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
};
name = Release;
};
Expand All @@ -511,7 +511,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = fr.openium.SwiftiumKitTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
Expand All @@ -522,7 +522,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = fr.openium.SwiftiumKitTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
};
name = Release;
};
Expand Down
1 change: 1 addition & 0 deletions SwiftiumKit/Crypto.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <sys/param.h>

#import <CommonCrypto/CommonDigest.h>
#import <CommonCrypto/CommonHMAC.h>
Expand Down
2 changes: 1 addition & 1 deletion SwiftiumKit/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.4.0</string>
<string>1.5.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
6 changes: 3 additions & 3 deletions SwiftiumKit/NSDataExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ private enum EncryptionAlgorithm {
extension Data {

public init?(base16EncodedString: String) {
let dataLen = base16EncodedString.characters.count / 2
let dataLen = base16EncodedString.count / 2
let bytes = UnsafeMutablePointer<UInt8>.allocate(capacity: dataLen)

let charactersAsUInt8 = base16EncodedString.characters.map {
let charactersAsUInt8 = base16EncodedString.map {
UInt8( strtoul((String($0)), nil, 16))
}

Expand Down Expand Up @@ -81,7 +81,7 @@ extension Data {

fileprivate func aesOperation(_ key: String, operation: SKCryptOperationFunction) -> Data? {
let lengthPtr = UnsafeMutablePointer<UInt>.allocate(capacity: 1)
defer { lengthPtr.deallocate(capacity: 1) }
defer { lengthPtr.deallocate() }

if let buffer = operation((self as NSData).bytes, UInt32(self.count), Array<UInt8>(key.utf8), UInt32(key.utf8.count), lengthPtr) {
let length: Int = Int(lengthPtr[0])
Expand Down
12 changes: 6 additions & 6 deletions SwiftiumKit/StringExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -176,22 +176,22 @@ extension String {
*/
public subscript(i: Int) -> String? {
get {
guard i >= -characters.count && i < characters.count else { return nil }
guard i >= -count && i < count else { return nil }

let charIndex: Index

if i >= 0 {
charIndex = index(startIndex, offsetBy: i)
} else {
charIndex = index(startIndex, offsetBy: characters.count + i)
charIndex = index(startIndex, offsetBy: count + i)
}

return String(self[charIndex])
}

set(newValue) {
guard i >= 0 && i < characters.count else {
preconditionFailure("String subscript can only be used if the condition (index >= 0 && index < characters.count) is fulfilled")
guard i >= 0 && i < count else {
preconditionFailure("String subscript can only be used if the condition (index >= 0 && index < count) is fulfilled")
}
guard newValue != nil else {
preconditionFailure("String replacement should not be nil")
Expand Down Expand Up @@ -226,7 +226,7 @@ extension String {
let lowerIndex = index(startIndex, offsetBy: maxSupportedLowerOffset, limitedBy: endIndex) ?? endIndex
let upperIndex = index(lowerIndex, offsetBy: maxSupportedUpperOffset, limitedBy: endIndex) ?? endIndex

return substring(with: lowerIndex..<upperIndex)
return String(self[lowerIndex..<upperIndex])
}

/**
Expand All @@ -248,7 +248,7 @@ extension String {
let lowerIndex = index(startIndex, offsetBy: maxSupportedLowerOffset, limitedBy: endIndex) ?? endIndex
let upperIndex = index(lowerIndex, offsetBy: maxSupportedUpperOffset, limitedBy: endIndex) ?? endIndex

return substring(with: lowerIndex..<upperIndex)
return String(self[lowerIndex..<upperIndex])
}
}

Expand Down
18 changes: 9 additions & 9 deletions SwiftiumKitTests/StringExtensionsTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class StringExtensionsTests: XCTestCase {

// When
let thirdChar = someString[3]
let lastChar = someString[someString.characters.count - 1]
let lastChar = someString[someString.count - 1]

// Expect
XCTAssertEqual(thirdChar, "d")
Expand All @@ -125,7 +125,7 @@ class StringExtensionsTests: XCTestCase {

// When
someString[0] = "A"
someString[someString.characters.count - 1] = "A"
someString[someString.count - 1] = "A"

// Expect
XCTAssertEqual(someString, expected)
Expand Down Expand Up @@ -162,7 +162,7 @@ class StringExtensionsTests: XCTestCase {
// When
let thirdLastChar = someString[-3]
let lastChart = someString[-1]
let firtChar = someString[-someString.characters.count]
let firtChar = someString[-someString.count]

// Expect
XCTAssertEqual(thirdLastChar, "f")
Expand All @@ -175,7 +175,7 @@ class StringExtensionsTests: XCTestCase {
let someString = "5f4dcc3b5aa765d61d8327deb882cf99";

// When
let outOfRangeChar = someString[someString.characters.count]
let outOfRangeChar = someString[someString.count]

// Expect
XCTAssertEqual(outOfRangeChar, nil)
Expand Down Expand Up @@ -230,7 +230,7 @@ class StringExtensionsTests: XCTestCase {
let someString = "5f4dcc3b5aa765d61d8327deb882cf99";

// When
let fullString = someString[-1...someString.characters.count]
let fullString = someString[-1...someString.count]

// Expect
XCTAssertEqual(fullString, someString)
Expand All @@ -241,7 +241,7 @@ class StringExtensionsTests: XCTestCase {
let someString = "5f4dcc3b5aa765d61d8327deb882cf99";

// When
let index = someString.characters.count - 4
let index = someString.count - 4
let last4Chars = someString[index...Int.max]

// Expect
Expand All @@ -264,7 +264,7 @@ class StringExtensionsTests: XCTestCase {
let someString = "5f4dcc3b5aa765d61d8327deb882cf99";

// When
let index = someString.characters.count - 4
let index = someString.count - 4
let last4Chars = someString[index..<Int.max]

// Expect
Expand Down Expand Up @@ -298,7 +298,7 @@ class StringExtensionsTests: XCTestCase {
let someString = "5f4dcc3b5aa765d61d8327deb882cf99";

// When
let fullString = someString[-1..<someString.characters.count]
let fullString = someString[-1..<someString.count]

// Expect
XCTAssertEqual(fullString, someString)
Expand All @@ -324,7 +324,7 @@ class StringExtensionsTests: XCTestCase {
let expected = "f4dcc3b5aa765d61d8327deb882cf99";

// When
someString[someString.characters.count] = ""
someString[someString.count] = ""

// Expect
XCTAssertEqual(someString, expected)
Expand Down
32 changes: 16 additions & 16 deletions SwiftiumKitTests/UIColorExtensionsTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ class UIColor_OSKAdditionsTests: XCTestCase {

// Expect
let f = c.cgColor.components
XCTAssertEqualWithAccuracy(f![0], r18, accuracy: precision)
XCTAssertEqualWithAccuracy(f![1], g18, accuracy: precision)
XCTAssertEqualWithAccuracy(f![2], b18, accuracy: precision)
XCTAssertEqualWithAccuracy(f![3], 1.0, accuracy: precision)
XCTAssertEqual(f![0], r18, accuracy: precision)
XCTAssertEqual(f![1], g18, accuracy: precision)
XCTAssertEqual(f![2], b18, accuracy: precision)
XCTAssertEqual(f![3], 1.0, accuracy: precision)
}

func testColorFromRGBA_alpha0() {
Expand All @@ -42,10 +42,10 @@ class UIColor_OSKAdditionsTests: XCTestCase {

// Expect
let f = c.cgColor.components
XCTAssertEqualWithAccuracy(f![0], r18, accuracy: precision)
XCTAssertEqualWithAccuracy(f![1], g18, accuracy: precision)
XCTAssertEqualWithAccuracy(f![2], b18, accuracy: precision)
XCTAssertEqualWithAccuracy(f![3], 0.0, accuracy: precision)
XCTAssertEqual(f![0], r18, accuracy: precision)
XCTAssertEqual(f![1], g18, accuracy: precision)
XCTAssertEqual(f![2], b18, accuracy: precision)
XCTAssertEqual(f![3], 0.0, accuracy: precision)
}

func testColorFromRGBA() {
Expand All @@ -57,10 +57,10 @@ class UIColor_OSKAdditionsTests: XCTestCase {

// Expect
let f = c.cgColor.components
XCTAssertEqualWithAccuracy(f![0], r18, accuracy: precision)
XCTAssertEqualWithAccuracy(f![1], g18, accuracy: precision)
XCTAssertEqualWithAccuracy(f![2], b18, accuracy: precision)
XCTAssertEqualWithAccuracy(f![3], a22, accuracy: precision)
XCTAssertEqual(f![0], r18, accuracy: precision)
XCTAssertEqual(f![1], g18, accuracy: precision)
XCTAssertEqual(f![2], b18, accuracy: precision)
XCTAssertEqual(f![3], a22, accuracy: precision)
}

func testColorFromARGB() {
Expand All @@ -72,10 +72,10 @@ class UIColor_OSKAdditionsTests: XCTestCase {

// Expect
let f = c.cgColor.components
XCTAssertEqualWithAccuracy(f![0], r18, accuracy: precision)
XCTAssertEqualWithAccuracy(f![1], g18, accuracy: precision)
XCTAssertEqualWithAccuracy(f![2], b18, accuracy: precision)
XCTAssertEqualWithAccuracy(f![3], a22, accuracy: precision)
XCTAssertEqual(f![0], r18, accuracy: precision)
XCTAssertEqual(f![1], g18, accuracy: precision)
XCTAssertEqual(f![2], b18, accuracy: precision)
XCTAssertEqual(f![3], a22, accuracy: precision)
}

func testImageWithSize_shouldReturnImageWithCorrectSize() {
Expand Down