Skip to content
This repository was archived by the owner on Feb 2, 2022. It is now read-only.

Commit cf56889

Browse files
authored
Merge pull request #37 from nodes-ios/swift-3.0
Updating master to swift 3
2 parents 151be0e + 5b9966a commit cf56889

26 files changed

+357
-274
lines changed

.travis.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
language: objective-c
2-
osx_image: xcode7.3
2+
osx_image: xcode8.1
33
branches:
44
only:
55
- master
@@ -9,12 +9,12 @@ env:
99
- PROJECT_NAME="Codemine.xcodeproj"
1010
- IOS_FRAMEWORK_SCHEME="Codemine"
1111

12-
- IOS_SDK=iphonesimulator9.3
13-
- OSX_SDK=macosx10.11
14-
- TVOS_SDK=appletvsimulator9.2
15-
- WATCHOS_SDK=watchsimulator2.2
12+
- IOS_SDK=iphonesimulator10.1
13+
- OSX_SDK=macosx10.12
14+
- TVOS_SDK=appletvsimulator10.0
15+
- WATCHOS_SDK=watchsimulator3.1
1616
matrix:
17-
- DESTINATION="OS=9.3,name=iPhone 6S Plus" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="YES"
17+
- DESTINATION="OS=10.1,name=iPhone 6S Plus" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="YES"
1818

1919
script:
2020
- set -o pipefail

Codemine.xcodeproj/project.pbxproj

Lines changed: 69 additions & 16 deletions
Large diffs are not rendered by default.

Codemine.xcodeproj/xcshareddata/xcschemes/Codemine-Mac.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0730"
3+
LastUpgradeVersion = "0800"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

Codemine.xcodeproj/xcshareddata/xcschemes/Codemine-tvOS.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0730"
3+
LastUpgradeVersion = "0800"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

Codemine.xcodeproj/xcshareddata/xcschemes/Codemine-watchOS.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0730"
3+
LastUpgradeVersion = "0800"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

Codemine.xcodeproj/xcshareddata/xcschemes/Codemine.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0710"
3+
LastUpgradeVersion = "0800"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

Codemine/Application.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ import Foundation
2323

2424
public struct Application {
2525

26-
private static func getString(key: String) -> String {
27-
guard let infoDictionary = NSBundle.mainBundle().infoDictionary,
28-
value = infoDictionary[key] as? String
26+
fileprivate static func getString(_ key: String) -> String {
27+
guard let infoDictionary = Bundle.main.infoDictionary,
28+
let value = infoDictionary[key] as? String
2929
else { return "" }
3030

3131
return value
@@ -52,10 +52,10 @@ public struct Application {
5252
}()
5353

5454
public static var schemes: [String] = {
55-
guard let infoDictionary = NSBundle.mainBundle().infoDictionary,
56-
urlTypes = infoDictionary["CFBundleURLTypes"] as? [AnyObject],
57-
urlType = urlTypes.first as? [String : AnyObject],
58-
urlSchemes = urlType["CFBundleURLSchemes"] as? [String]
55+
guard let infoDictionary = Bundle.main.infoDictionary,
56+
let urlTypes = infoDictionary["CFBundleURLTypes"] as? [AnyObject],
57+
let urlType = urlTypes.first as? [String : AnyObject],
58+
let urlSchemes = urlType["CFBundleURLSchemes"] as? [String]
5959
else { return [] }
6060

6161
return urlSchemes
@@ -65,4 +65,4 @@ public struct Application {
6565
return schemes.first
6666
}()
6767

68-
}
68+
}

Codemine/Extensions/CGPoint+Utilities.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public extension CGPoint {
2121

2222
- Returns: `Boolean` - if close to return true, else false.
2323
*/
24-
func isCloseTo(point: CGPoint, tolerance: CGFloat) -> Bool {
24+
func isCloseTo(_ point: CGPoint, tolerance: CGFloat) -> Bool {
2525
let xIsClose = self.x <= point.x + tolerance && self.x >= point.x - tolerance
2626
let yIsClose = self.y <= point.y + tolerance && self.y >= point.y - tolerance
2727
return xIsClose && yIsClose

Codemine/Extensions/CGRect+Utilities.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public extension CGRect {
1313
/// Getter & Setter for a `CGRect`'s `origin.y`
1414
public var y: CGFloat {
1515
set {
16-
self = CGRect(origin: CGPointMake(origin.x, newValue), size: size)
16+
self = CGRect(origin: CGPoint(x: origin.x, y: newValue), size: size)
1717
}
1818
get {
1919
return self.origin.y
@@ -23,7 +23,7 @@ public extension CGRect {
2323
/// Getter & Setter for a `CGRect`s `origin.x`
2424
public var x: CGFloat {
2525
set {
26-
self = CGRect(origin: CGPointMake(newValue, origin.y), size: size)
26+
self = CGRect(origin: CGPoint(x: newValue, y: origin.y), size: size)
2727
}
2828
get {
2929
return self.origin.x
@@ -35,7 +35,7 @@ public extension CGRect {
3535

3636
- returns: a new CGRect with the width and height reversed to those of the current one
3737
*/
38-
public func rectByReversingSize() -> CGRect {
39-
return CGRect(origin: self.origin, size: CGSizeMake(self.height, self.width))
38+
public var reversingSize: CGRect {
39+
return CGRect(origin: origin, size: CGSize(width: height, height: width))
4040
}
41-
}
41+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
//
2+
// DispatchTime+Utilities.swift
3+
// Codemine
4+
//
5+
// Created by Marius Constantinescu on 11/11/2016.
6+
// Copyright © 2016 Nodes. All rights reserved.
7+
//
8+
9+
import Foundation
10+
11+
// Credits for this go to Russ Bishop http://www.russbishop.net/quick-easy-dispatchtime
12+
13+
extension DispatchTime: ExpressibleByIntegerLiteral {
14+
public init(integerLiteral value: Int) {
15+
self = DispatchTime.now() + .seconds(value)
16+
}
17+
}
18+
19+
extension DispatchTime: ExpressibleByFloatLiteral {
20+
public init(floatLiteral value: Double) {
21+
self = DispatchTime.now() + .milliseconds(Int(value * 1000))
22+
}
23+
}

0 commit comments

Comments
 (0)