Skip to content

Commit 3039139

Browse files
authored
Merge pull request #7 from NextFaze/feature/swift4
Feature/swift4
2 parents 24da734 + 540310a commit 3039139

File tree

8 files changed

+109
-45
lines changed

8 files changed

+109
-45
lines changed

.swift-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.0
1+
4.0

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# * https://github.com/supermarin/xcpretty#usage
44

55
language: objective-c # still specify this even though we are using swift - appears to tell travis which Xcode version to use
6-
osx_image: xcode8
6+
osx_image: xcode9.1
77
#cache: cocoapods
88
podfile: Example/Podfile
99
before_install:
@@ -15,7 +15,7 @@ script:
1515
- set -o pipefail
1616
- xcodebuild -version
1717
- xcodebuild -showsdks
18-
- xcodebuild build test -workspace Example/FazeKit.xcworkspace -scheme FazeKit-Example -sdk iphonesimulator10.0 -destination 'platform=iOS Simulator,name=iPhone 6,OS=10.0' ONLY_ACTIVE_ARCH=NO | xcpretty
18+
- xcodebuild build test -workspace Example/FazeKit.xcworkspace -scheme FazeKit-Example -destination 'platform=iOS Simulator,name=iPhone SE' ONLY_ACTIVE_ARCH=NO | xcpretty
1919
- pod lib lint
2020
notifications:
2121
slack:

Example/FazeKit.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
607FACE01AFB9204008FA782 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */; };
1515
607FACEC1AFB9204008FA782 /* UIViewAdditionsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACEB1AFB9204008FA782 /* UIViewAdditionsTests.swift */; };
1616
78B6DD4BAF21BA4B263F3EF4 /* Pods_FazeKit_Tests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DB0AD919FBE4556CA363D8B /* Pods_FazeKit_Tests.framework */; };
17+
7CDA2BCA1FE872FE00CBA532 /* StringAdditionsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CDA2BC91FE872FE00CBA532 /* StringAdditionsTests.swift */; };
1718
C20FAFE21DD42EAA009E5C3F /* MulticastTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C20FAFE01DD42E7D009E5C3F /* MulticastTests.swift */; };
1819
C2B9A0321DD29F9100AF4E04 /* DateAdditionsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C2B9A0301DD2941C00AF4E04 /* DateAdditionsTests.swift */; };
1920
C2B9A0381DD2DAE500AF4E04 /* CollectionAdditionsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C2B9A0361DD2DAB500AF4E04 /* CollectionAdditionsTests.swift */; };
@@ -45,6 +46,7 @@
4546
607FACEA1AFB9204008FA782 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
4647
607FACEB1AFB9204008FA782 /* UIViewAdditionsTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIViewAdditionsTests.swift; sourceTree = "<group>"; };
4748
739B56FA57C1D0E13427B629 /* Pods-FazeKit_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FazeKit_Tests.release.xcconfig"; path = "Pods/Target Support Files/Pods-FazeKit_Tests/Pods-FazeKit_Tests.release.xcconfig"; sourceTree = "<group>"; };
49+
7CDA2BC91FE872FE00CBA532 /* StringAdditionsTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StringAdditionsTests.swift; sourceTree = "<group>"; };
4850
AE54F13DF076B827802B2E27 /* Pods-FazeKit_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FazeKit_Example.debug.xcconfig"; path = "Pods/Target Support Files/Pods-FazeKit_Example/Pods-FazeKit_Example.debug.xcconfig"; sourceTree = "<group>"; };
4951
C20FAFE01DD42E7D009E5C3F /* MulticastTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MulticastTests.swift; sourceTree = "<group>"; };
5052
C2B9A0301DD2941C00AF4E04 /* DateAdditionsTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DateAdditionsTests.swift; sourceTree = "<group>"; };
@@ -133,6 +135,7 @@
133135
C2B9A0301DD2941C00AF4E04 /* DateAdditionsTests.swift */,
134136
C20FAFE01DD42E7D009E5C3F /* MulticastTests.swift */,
135137
C2E94BAD1D62CDD5007A7A4C /* ProcessInfoAdditionsTests.swift */,
138+
7CDA2BC91FE872FE00CBA532 /* StringAdditionsTests.swift */,
136139
607FACEB1AFB9204008FA782 /* UIViewAdditionsTests.swift */,
137140
607FACE91AFB9204008FA782 /* Supporting Files */,
138141
);
@@ -384,6 +387,7 @@
384387
607FACEC1AFB9204008FA782 /* UIViewAdditionsTests.swift in Sources */,
385388
C2B9A0321DD29F9100AF4E04 /* DateAdditionsTests.swift in Sources */,
386389
C20FAFE21DD42EAA009E5C3F /* MulticastTests.swift in Sources */,
390+
7CDA2BCA1FE872FE00CBA532 /* StringAdditionsTests.swift in Sources */,
387391
C2B9A0381DD2DAE500AF4E04 /* CollectionAdditionsTests.swift in Sources */,
388392
);
389393
runOnlyForDeploymentPostprocessing = 0;

Example/Pods/Pods.xcodeproj/project.pbxproj

Lines changed: 16 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
//
2+
// Copyright 2017 NextFaze
3+
//
4+
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
5+
// use this file except in compliance with the License. You may obtain a copy
6+
// of the License at
7+
//
8+
// http://www.apache.org/licenses/LICENSE-2.0
9+
//
10+
// Unless required by applicable law or agreed to in writing, software
11+
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12+
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13+
// License for the specific language governing permissions and limitations
14+
// under the License.
15+
//
16+
// StringAdditionsTests.swift
17+
// FazeKit_Tests
18+
//
19+
// Created by Ricardo Santos on 19/12/17.
20+
//
21+
22+
import Foundation
23+
import XCTest
24+
import FazeKit
25+
26+
class StringAdditionsTests: XCTestCase {
27+
28+
override func setUp() {
29+
super.setUp()
30+
}
31+
32+
override func tearDown() {
33+
super.tearDown()
34+
}
35+
36+
func testContains() {
37+
let string = "Abcdefgh"
38+
XCTAssertTrue(string.contains("A"), "String.contains: should have found a match")
39+
XCTAssertFalse(string.contains("a"), "String.contains: should not have found a match")
40+
XCTAssertFalse(string.contains("z"), "String.contains: should not have found a match")
41+
}
42+
43+
func testReplace() {
44+
var string = "The cat jumped over the hat"
45+
string = string.replace("cat", withString: "dog")
46+
XCTAssertTrue(string.contains("dog"), "String.replace: should contain the replacement substring")
47+
XCTAssertFalse(string.contains("cat"), "String.replace: should not still contain the original substring")
48+
}
49+
50+
func testSubscript() {
51+
let string = "OMG. I can't believe it's a thing!"
52+
XCTAssertTrue(string[0] == "O", "String.subscript: should return the Character O")
53+
XCTAssertTrue(string[1] == "M", "String.subscript: should return the Character M")
54+
XCTAssertTrue(string[2] == "G", "String.subscript: should return the Character G")
55+
}
56+
57+
func testSubstring() {
58+
let string = "OMG. Is this even a thing?"
59+
XCTAssertTrue(string.substring(0, length: 3) == "OMG", "String.substring: should create a new substring")
60+
}
61+
62+
func testTrim() {
63+
let string = " Hello World \n\n\n "
64+
XCTAssertTrue(string.trim() == "Hello World", "String.trim(): should remove all whitespace and newlines")
65+
}
66+
67+
}

FazeKit/Classes/CollectionAdditions.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,24 +56,24 @@ public extension Sequence {
5656
}
5757
}
5858

59-
public func +<K: Hashable, V>(lhs: Dictionary<K, V>, rhs: Dictionary<K, V>) -> Dictionary<K, V> {
59+
public func +<K, V>(lhs: Dictionary<K, V>, rhs: Dictionary<K, V>) -> Dictionary<K, V> {
6060
var dict = Dictionary<K, V>()
6161
lhs.forEach { dict[$0.key] = $0.value }
6262
rhs.forEach { dict[$0.key] = $0.value }
6363
return dict
6464
}
6565

66-
public func -<K: Hashable, V>(lhs: Dictionary<K, V>, rhs: Dictionary<K, V>) -> Dictionary<K, V> {
66+
public func -<K, V>(lhs: Dictionary<K, V>, rhs: Dictionary<K, V>) -> Dictionary<K, V> {
6767
var dict = Dictionary<K, V>()
6868
lhs.forEach { dict[$0.key] = $0.value }
6969
rhs.forEach { dict.removeValue(forKey: $0.key) }
7070
return dict
7171
}
7272

73-
public func +=<K: Hashable, V>(lhs: inout Dictionary<K, V>, rhs: Dictionary<K, V>) {
73+
public func +=<K, V>(lhs: inout Dictionary<K, V>, rhs: Dictionary<K, V>) {
7474
rhs.forEach { lhs[$0.key] = $0.value }
7575
}
7676

77-
public func -=<K: Hashable, V>(lhs: inout Dictionary<K, V>, rhs: Dictionary<K, V>) {
77+
public func -=<K, V>(lhs: inout Dictionary<K, V>, rhs: Dictionary<K, V>) {
7878
rhs.forEach { lhs.removeValue(forKey: $0.key) }
7979
}

0 commit comments

Comments
 (0)