Skip to content

Commit

Permalink
Merge pull request #6 from ekurutepe/swfit-5
Browse files Browse the repository at this point in the history
Swift 5
  • Loading branch information
ekurutepe authored Mar 31, 2019
2 parents 0506a9e + 1433fb3 commit 1a2bc66
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 29 deletions.
23 changes: 11 additions & 12 deletions Iguazu.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -264,16 +264,16 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0810;
LastUpgradeCheck = 0930;
LastUpgradeCheck = 1020;
ORGANIZATIONNAME = "Fifteen Jugglers Software";
TargetAttributes = {
8722EF2C1D0DD90500DA4509 = {
CreatedOnToolsVersion = 7.3.1;
LastSwiftMigration = 0930;
LastSwiftMigration = 1020;
};
8722EF361D0DD90500DA4509 = {
CreatedOnToolsVersion = 7.3.1;
LastSwiftMigration = 0930;
LastSwiftMigration = 1020;
};
877B9D0E1DFC225800D2EB91 = {
CreatedOnToolsVersion = 8.1;
Expand All @@ -284,10 +284,11 @@
};
buildConfigurationList = 8722EF271D0DD90500DA4509 /* Build configuration list for PBXProject "Iguazu" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 8722EF231D0DD90500DA4509;
productRefGroup = 8722EF2E1D0DD90500DA4509 /* Products */;
Expand Down Expand Up @@ -391,6 +392,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
Expand Down Expand Up @@ -452,6 +454,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
Expand Down Expand Up @@ -519,8 +522,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -541,8 +543,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand All @@ -553,8 +554,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.fifteenjugglers.IguazuTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -566,8 +566,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.fifteenjugglers.IguazuTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand Down
2 changes: 1 addition & 1 deletion Iguazu.xcodeproj/xcshareddata/xcschemes/Iguazu.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0930"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0930"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
12 changes: 6 additions & 6 deletions Iguazu/AirSpace.swift
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public extension AirSpace {
}
}

public static func airSpacesByClass(from openAirString:String) -> AirSpacesByClassDictionary? {
static func airSpacesByClass(from openAirString:String) -> AirSpacesByClassDictionary? {
let lines = openAirString.components(separatedBy: .newlines)

var airSpaces = [AirSpaceClass: [AirSpace]]()
Expand Down Expand Up @@ -169,8 +169,8 @@ public extension AirSpace {
currentAirspace?.labelCoordinates?.append(coord)
case "V":
if value.hasPrefix("X") {
let eqRange = value.range(of: "=")!
state.x = coordinate(from: value.dropFirst(eqRange.upperBound.encodedOffset))
guard let eqRange = value.range(of: "=") else { assertionFailure("malformed X"); return nil }
state.x = coordinate(from: value.suffix(from: eqRange.upperBound))
} else if value.hasPrefix("D") {
guard let signRange = value.rangeOfCharacter(from: .plusMinus) else { fatalError("malformed direction line: \(line)") }
let sign = value[signRange.lowerBound ..< signRange.upperBound]
Expand Down Expand Up @@ -227,15 +227,15 @@ public extension AirSpace {
return airSpaces
}

public static func airSpaces(from openAirString:String) -> [AirSpace]? {
static func airSpaces(from openAirString:String) -> [AirSpace]? {
guard let airspaces = self.airSpacesByClass(from: openAirString) else { return nil }
let flatAirSpaces = airspaces.reduce([AirSpace]()) { (res, tuple) -> [AirSpace] in
return res + tuple.value
}
return flatAirSpaces
}

public static func airSpacesByClass(withContentsOf url: URL) ->AirSpacesByClassDictionary? {
static func airSpacesByClass(withContentsOf url: URL) ->AirSpacesByClassDictionary? {
var openAirString = ""
do {
openAirString = try String(contentsOf: url, encoding: .ascii)
Expand All @@ -247,7 +247,7 @@ public extension AirSpace {
return self.airSpacesByClass(from: openAirString)
}

public static func airSpaces(withContentsOf url: URL) -> [AirSpace]? {
static func airSpaces(withContentsOf url: URL) -> [AirSpace]? {
var openAirString = ""
do {
openAirString = try String(contentsOf: url, encoding: .ascii)
Expand Down
2 changes: 1 addition & 1 deletion Iguazu/AirSpaceMapDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class AirSpaceMapDelegate: NSObject, MKMapViewDelegate {
}

public extension AirSpaceClass {
public var color: UIColor {
var color: UIColor {
switch self {
case .Danger:
return .black
Expand Down
6 changes: 3 additions & 3 deletions Iguazu/IGCHeader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public enum IGCHeaderField {
static func parseDateString(hLine: String) -> IGCHeaderField {
guard let prefixRange = hLine.range(of: HeaderRecordCode.date.rawValue) else { fatalError() }

let dateString = hLine.dropFirst(prefixRange.upperBound.encodedOffset)
let dateString = hLine.suffix(from: prefixRange.upperBound)

guard let date = Date.parse(headerDateString: String(dateString)) else { fatalError() }

Expand All @@ -127,7 +127,7 @@ public enum IGCHeaderField {
static func parseAccuracyString(hLine: String) -> IGCHeaderField {
guard let prefixRange = hLine.range(of: HeaderRecordCode.accuracy.rawValue) else { fatalError() }

let accuracyString = hLine.dropFirst(prefixRange.upperBound.encodedOffset)
let accuracyString = hLine.suffix(from: prefixRange.upperBound)

guard let accuracy = Int(accuracyString) else { fatalError() }

Expand All @@ -138,7 +138,7 @@ public enum IGCHeaderField {
guard let _ = line.range(of: prefix),
let separatorRange = line.range(of: ":") else { fatalError() }

let value = line.dropFirst(separatorRange.upperBound.encodedOffset)
let value = line.suffix(from: separatorRange.upperBound)
.trimmingCharacters(in: .whitespacesAndNewlines)

return value
Expand Down
6 changes: 4 additions & 2 deletions IguazuDemoApp/IguazuDemoApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0800;
LastUpgradeCheck = 0930;
LastUpgradeCheck = 1020;
ORGANIZATIONNAME = "Fifteen Jugglers Software";
TargetAttributes = {
87F2E8361D6632B000FA4CD2 = {
Expand All @@ -141,7 +141,7 @@
};
buildConfigurationList = 87F2E8321D6632B000FA4CD2 /* Build configuration list for PBXProject "IguazuDemoApp" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Expand Down Expand Up @@ -209,6 +209,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
Expand Down Expand Up @@ -267,6 +268,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
Expand Down
6 changes: 3 additions & 3 deletions IguazuTests/AirSpaceTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ class AirSpaceTests : XCTestCase {
func testGeoJsonEncoding() {
let airSpaces = AirSpace.airSpaces(from: self.openAirString)
XCTAssertNotNil(airSpaces)
let asp = airSpaces![0]
let geoJson = asp.geoJsonString
XCTAssertEqual(geoJson, "{\"type\":\"Feature\",\"properties\":{\"ceiling\":1981,\"name\":\"TMZ-EDLW 129.875\",\"type\":\"TMZ\",\"floor\":1371},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[7.3055555555555554,51.516666666666666],[7.3055555555555554,51.516666666666666],[7.3433333333333328,51.423888888888889],[7.4625000000000004,51.31305555555555],[7.4519444444444449,51.408333333333331],[7.3741666666666665,51.493055555555557],[7.3055555555555554,51.516666666666666]]]}}")
let asp = airSpaces!.sorted { $0.name < $1.name }.first!
let geoJson = asp.geoJsonString!
XCTAssertEqual(geoJson, "{\"type\":\"Feature\",\"properties\":{\"ceiling\":3048,\"name\":\"Alb-Nord_1 134.500\\/128.950\",\"type\":\"W\",\"floor\":1371},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[9.1911111111111108,48.49111111111111],[9.1911111111111108,48.49111111111111],[9.1538888888888899,48.448888888888888],[9.6255555555555556,48.5625],[9.7336111111111094,48.609722222222224],[9.7349230892731793,48.609520950496226],[9.741929358825363,48.633060982012317],[9.746520437934155,48.656859742857833],[9.7486720047168376,48.680808933269006],[9.7472222222222218,48.680833333333332],[9.6236111111111118,48.648333333333333],[9.4222222222222225,48.574722222222228],[9.3727777777777774,48.565555555555555],[9.1911111111111108,48.49111111111111]]]}}")

}
}

0 comments on commit 1a2bc66

Please sign in to comment.