Skip to content

Commit 1fafa54

Browse files
authored
Swift 5 (#7)
1 parent 3abc9d8 commit 1fafa54

15 files changed

Lines changed: 44 additions & 42 deletions

File tree

‎Cartfile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
github "MonsantoCo/GeospatialSwift" ~> 0.3.0
1+
github "MonsantoCo/GeospatialSwift" ~> 0.4.0

‎Cartfile.resolved‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
github "MonsantoCo/GeospatialSwift" "0.3.0"
2-
github "MonsantoCo/TimberSwift" "0.1.3"
1+
github "MonsantoCo/GeospatialSwift" "0.4.0"
2+
github "MonsantoCo/TimberSwift" "0.2.0"

‎GeospatialKit.xcodeproj/project.pbxproj‎

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -719,29 +719,29 @@
719719
isa = PBXProject;
720720
attributes = {
721721
LastSwiftUpdateCheck = 0830;
722-
LastUpgradeCheck = 0940;
722+
LastUpgradeCheck = 1020;
723723
ORGANIZATIONNAME = Monsanto;
724724
TargetAttributes = {
725725
1E528EBC1EC20CDF00A2A9C9 = {
726726
CreatedOnToolsVersion = 8.3.2;
727-
LastSwiftMigration = 0910;
727+
LastSwiftMigration = 1020;
728728
ProvisioningStyle = Automatic;
729729
};
730730
1E528EC51EC20CDF00A2A9C9 = {
731731
CreatedOnToolsVersion = 8.3.2;
732-
LastSwiftMigration = 0910;
732+
LastSwiftMigration = 1020;
733733
ProvisioningStyle = Automatic;
734734
};
735735
1E528EF91EC20E0000A2A9C9 = {
736736
CreatedOnToolsVersion = 8.3.2;
737-
LastSwiftMigration = 0910;
737+
LastSwiftMigration = 1020;
738738
ProvisioningStyle = Automatic;
739739
};
740740
};
741741
};
742742
buildConfigurationList = 1E528EB71EC20CDF00A2A9C9 /* Build configuration list for PBXProject "GeospatialKit" */;
743743
compatibilityVersion = "Xcode 3.2";
744-
developmentRegion = English;
744+
developmentRegion = en;
745745
hasScannedForEncodings = 0;
746746
knownRegions = (
747747
en,
@@ -800,7 +800,7 @@
800800
/* Begin PBXShellScriptBuildPhase section */
801801
1E7A6CD32097A6A00063F01F /* Run Script - Carthage Copy Frameworks */ = {
802802
isa = PBXShellScriptBuildPhase;
803-
buildActionMask = 2147483647;
803+
buildActionMask = 12;
804804
files = (
805805
);
806806
inputPaths = (
@@ -814,7 +814,7 @@
814814
);
815815
runOnlyForDeploymentPostprocessing = 0;
816816
shellPath = /bin/sh;
817-
shellScript = "/usr/local/bin/carthage copy-frameworks";
817+
shellScript = "/usr/local/bin/carthage copy-frameworks\n";
818818
};
819819
1E7A6CD42097A6A70063F01F /* Run Script - Carthage Copy Frameworks */ = {
820820
isa = PBXShellScriptBuildPhase;
@@ -832,7 +832,7 @@
832832
);
833833
runOnlyForDeploymentPostprocessing = 0;
834834
shellPath = /bin/sh;
835-
shellScript = "/usr/local/bin/carthage copy-frameworks";
835+
shellScript = "/usr/local/bin/carthage copy-frameworks\n";
836836
};
837837
1EF353FC1FA2854D0008DE4C /* Run Script - Swift Lint */ = {
838838
isa = PBXShellScriptBuildPhase;
@@ -959,6 +959,7 @@
959959
isa = XCBuildConfiguration;
960960
buildSettings = {
961961
ALWAYS_SEARCH_USER_PATHS = NO;
962+
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
962963
CLANG_ANALYZER_NONNULL = YES;
963964
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
964965
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
@@ -1023,6 +1024,7 @@
10231024
isa = XCBuildConfiguration;
10241025
buildSettings = {
10251026
ALWAYS_SEARCH_USER_PATHS = NO;
1027+
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
10261028
CLANG_ANALYZER_NONNULL = YES;
10271029
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
10281030
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
@@ -1095,7 +1097,7 @@
10951097
PRODUCT_NAME = "$(TARGET_NAME)";
10961098
SKIP_INSTALL = YES;
10971099
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
1098-
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
1100+
SWIFT_VERSION = 5.0;
10991101
};
11001102
name = Debug;
11011103
};
@@ -1117,7 +1119,7 @@
11171119
PRODUCT_BUNDLE_IDENTIFIER = com.monsanto.GeospatialKit;
11181120
PRODUCT_NAME = "$(TARGET_NAME)";
11191121
SKIP_INSTALL = YES;
1120-
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
1122+
SWIFT_VERSION = 5.0;
11211123
};
11221124
name = Release;
11231125
};
@@ -1133,7 +1135,7 @@
11331135
PRODUCT_BUNDLE_IDENTIFIER = com.monsanto.GeospatialKitTests;
11341136
PRODUCT_NAME = "$(TARGET_NAME)";
11351137
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
1136-
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
1138+
SWIFT_VERSION = 5.0;
11371139
};
11381140
name = Debug;
11391141
};
@@ -1148,7 +1150,7 @@
11481150
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
11491151
PRODUCT_BUNDLE_IDENTIFIER = com.monsanto.GeospatialKitTests;
11501152
PRODUCT_NAME = "$(TARGET_NAME)";
1151-
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
1153+
SWIFT_VERSION = 5.0;
11521154
};
11531155
name = Release;
11541156
};
@@ -1166,7 +1168,7 @@
11661168
PRODUCT_BUNDLE_IDENTIFIER = com.monsanto.GeospatialKitExample;
11671169
PRODUCT_NAME = "$(TARGET_NAME)";
11681170
PROVISIONING_PROFILE_SPECIFIER = "";
1169-
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
1171+
SWIFT_VERSION = 5.0;
11701172
};
11711173
name = Debug;
11721174
};
@@ -1184,7 +1186,7 @@
11841186
PRODUCT_BUNDLE_IDENTIFIER = com.monsanto.GeospatialKitExample;
11851187
PRODUCT_NAME = "$(TARGET_NAME)";
11861188
PROVISIONING_PROFILE_SPECIFIER = "";
1187-
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
1189+
SWIFT_VERSION = 5.0;
11881190
};
11891191
name = Release;
11901192
};

‎GeospatialKit.xcodeproj/xcshareddata/xcschemes/GeospatialKit.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 = "0940"
3+
LastUpgradeVersion = "1020"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

‎GeospatialKit.xcodeproj/xcshareddata/xcschemes/GeospatialKitExample.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 = "0940"
3+
LastUpgradeVersion = "1020"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

‎GeospatialKit/Draw/PointProjector.swift‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ internal struct PointProjector {
66
// Future: Could add a coordinate system rather than width and height which might not assume (0,0) as the base coordinate
77
init(boundingBox: GeodesicBoundingBox, width: Double, height: Double) {
88
// Rotated 90 degrees for UIView coordinate system, MKMapPoint representing upper left corner of geometry bounds
9-
let projectedUpperLeft = MKMapPointForCoordinate(CLLocationCoordinate2D(latitude: boundingBox.maxLatitude, longitude: boundingBox.minLongitude))
9+
let projectedUpperLeft = MKMapPoint(CLLocationCoordinate2D(latitude: boundingBox.maxLatitude, longitude: boundingBox.minLongitude))
1010

1111
// Rotated 90 degrees for UIView coordinate system, MKMapPoint representing lower right corner of geometry bounds
12-
let projectedLowerRight = MKMapPointForCoordinate(CLLocationCoordinate2D(latitude: boundingBox.minLatitude, longitude: boundingBox.maxLongitude))
12+
let projectedLowerRight = MKMapPoint(CLLocationCoordinate2D(latitude: boundingBox.minLatitude, longitude: boundingBox.maxLongitude))
1313

1414
let projectedWidth = projectedLowerRight.x - projectedUpperLeft.x
1515
let projectedHeight = projectedLowerRight.y - projectedUpperLeft.y
@@ -31,7 +31,7 @@ internal struct PointProjector {
3131

3232
func asPoints(_ points: [GeodesicPoint]) -> [CGPoint] {
3333
return points.map { point in
34-
let projectedCoordinate = MKMapPointForCoordinate(CLLocationCoordinate2D(latitude: point.latitude, longitude: point.longitude))
34+
let projectedCoordinate = MKMapPoint(CLLocationCoordinate2D(latitude: point.latitude, longitude: point.longitude))
3535

3636
// Convert to the expected scale
3737
let scaledProjectedX = projectedCoordinate.x * scale

‎GeospatialKit/Extensions/GeoJsonPolygon.swift‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
public extension GeoJsonPolygon {
2-
public func cocoaContains(_ point: GeodesicPoint, errorDistance: Double) -> Bool {
2+
func cocoaContains(_ point: GeodesicPoint, errorDistance: Double) -> Bool {
33
let polygonCoordinates = linearRings.first!.points.map { $0.locationCoordinate }
44

55
let polygonOverlay = MKPolygon(coordinates: polygonCoordinates, count: polygonCoordinates.count)
66

77
let polygonRenderer = MKPolygonRenderer(overlay: polygonOverlay)
88

9-
let mapPoint: MKMapPoint = MKMapPointForCoordinate(point.locationCoordinate)
9+
let mapPoint: MKMapPoint = MKMapPoint(point.locationCoordinate)
1010
let polygonViewPoint: CGPoint = polygonRenderer.point(for: mapPoint)
1111

1212
guard errorDistance >= 0 else { return distance(to: point) > abs(errorDistance) && polygonRenderer.path.contains(polygonViewPoint) }
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
public extension GeodesicBoundingBox {
22
internal var imageMinimumAdjustment: Double { return 0.00005 }
33

4-
public var region: MKCoordinateRegion {
4+
var region: MKCoordinateRegion {
55
let span = MKCoordinateSpan(latitudeDelta: latitudeDelta, longitudeDelta: longitudeDelta)
66

77
let center = CLLocationCoordinate2D(latitude: centroid.latitude, longitude: centroid.longitude)
88

99
return MKCoordinateRegion(center: center, span: span)
1010
}
1111

12-
public func mappingBoundingBox(insetPercent: Double) -> GeodesicBoundingBox {
12+
func mappingBoundingBox(insetPercent: Double) -> GeodesicBoundingBox {
1313
return validBoundingBox(minimumAdjustment: imageMinimumAdjustment).insetBoundingBox(percent: insetPercent)
1414
}
1515
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
public extension GeodesicPoint {
2-
public var locationCoordinate: CLLocationCoordinate2D { return CLLocationCoordinate2D(latitude: latitude, longitude: longitude) }
2+
var locationCoordinate: CLLocationCoordinate2D { return CLLocationCoordinate2D(latitude: latitude, longitude: longitude) }
33
}

‎GeospatialKit/Image/ImageGenerator.swift‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ public protocol ImageGeneratorProtocol {
44
}
55

66
internal struct SnapshotSettings {
7-
let snapshot: MKMapSnapshot
7+
let snapshot: MKMapSnapshotter.Snapshot
88
let scale: Double
99
}
1010

@@ -22,7 +22,7 @@ internal class ImageGenerator: ImageGeneratorProtocol {
2222
let width = width * Double(UIScreen.main.scale) / snapshotScale
2323
let height = height * Double(UIScreen.main.scale) / snapshotScale
2424

25-
let mapSnapshotOptions = MKMapSnapshotOptions()
25+
let mapSnapshotOptions = MKMapSnapshotter.Options()
2626
mapSnapshotOptions.region = region
2727
mapSnapshotOptions.scale = UIScreen.main.scale
2828
mapSnapshotOptions.size = CGSize(width: width, height: height)

0 commit comments

Comments
 (0)