From c2fa4b539bfdb7a5f6c29b8f2b4dd7ce82683acb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguye=CC=82=CC=83n?= Date: Thu, 23 Feb 2017 01:46:18 -0800 Subject: [PATCH 1/5] Depend on Polyline.framework --- Cartfile | 2 ++ Cartfile.resolved | 4 ++- MapboxStatic.swift.podspec | 2 ++ MapboxStatic.xcodeproj/project.pbxproj | 48 ++++++++++++++++++++++++++ MapboxStatic/Overlay.swift | 40 ++------------------- 5 files changed, 57 insertions(+), 39 deletions(-) create mode 100644 Cartfile diff --git a/Cartfile b/Cartfile new file mode 100644 index 0000000..5a0026a --- /dev/null +++ b/Cartfile @@ -0,0 +1,2 @@ +github "raphaelmor/Polyline" ~> 4.2 + diff --git a/Cartfile.resolved b/Cartfile.resolved index bf0e19e..5c0ad66 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1 +1,3 @@ -github "AliSoftware/OHHTTPStubs" "6.0.0" +github "AliSoftware/OHHTTPStubs" "6.1.0" +github "raphaelmor/Polyline" "v4.2.0" + diff --git a/MapboxStatic.swift.podspec b/MapboxStatic.swift.podspec index c65f682..ab0e607 100644 --- a/MapboxStatic.swift.podspec +++ b/MapboxStatic.swift.podspec @@ -42,4 +42,6 @@ Pod::Spec.new do |s| s.requires_arc = true s.module_name = "MapboxStatic" + s.dependency "Polyline", "~> 4.2" + end diff --git a/MapboxStatic.xcodeproj/project.pbxproj b/MapboxStatic.xcodeproj/project.pbxproj index d06bd6f..02724e7 100644 --- a/MapboxStatic.xcodeproj/project.pbxproj +++ b/MapboxStatic.xcodeproj/project.pbxproj @@ -91,6 +91,10 @@ DA1BA2861E6D39AE007F9FAC /* path.png in Resources */ = {isa = PBXBuildFile; fileRef = DA1BA2851E6D39AE007F9FAC /* path.png */; }; DA1BA2871E6D39AE007F9FAC /* path.png in Resources */ = {isa = PBXBuildFile; fileRef = DA1BA2851E6D39AE007F9FAC /* path.png */; }; DA1BA2881E6D39AE007F9FAC /* path.png in Resources */ = {isa = PBXBuildFile; fileRef = DA1BA2851E6D39AE007F9FAC /* path.png */; }; + DA0584D61E5EE5E6006F138F /* Polyline.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA0584D51E5EE5E6006F138F /* Polyline.framework */; }; + DA0584D81E5EE601006F138F /* Polyline.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA0584D71E5EE601006F138F /* Polyline.framework */; }; + DA0584DA1E5EE60A006F138F /* Polyline.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA0584D91E5EE60A006F138F /* Polyline.framework */; }; + DA0584DC1E5EE60F006F138F /* Polyline.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA0584DB1E5EE60F006F138F /* Polyline.framework */; }; DA20FB9E1CE3DEBB00B07762 /* MapboxStatic.h in Headers */ = {isa = PBXBuildFile; fileRef = DA20FB9D1CE3DEBB00B07762 /* MapboxStatic.h */; settings = {ATTRIBUTES = (Public, ); }; }; DA20FBA21CE3DEBB00B07762 /* MapboxStatic.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA20FB9B1CE3DEBB00B07762 /* MapboxStatic.framework */; }; DA20FBA81CE3DF6900B07762 /* Snapshot.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDAD19871BD9B3970057AC9F /* Snapshot.swift */; }; @@ -208,6 +212,10 @@ DA1BA27D1E6D2DE3007F9FAC /* rocket.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = rocket.png; sourceTree = ""; }; DA1BA2811E6D3386007F9FAC /* geojson.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = geojson.png; sourceTree = ""; }; DA1BA2851E6D39AE007F9FAC /* path.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = path.png; sourceTree = ""; }; + DA0584D51E5EE5E6006F138F /* Polyline.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Polyline.framework; path = Carthage/Build/iOS/Polyline.framework; sourceTree = ""; }; + DA0584D71E5EE601006F138F /* Polyline.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Polyline.framework; path = Carthage/Build/Mac/Polyline.framework; sourceTree = ""; }; + DA0584D91E5EE60A006F138F /* Polyline.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Polyline.framework; path = Carthage/Build/tvOS/Polyline.framework; sourceTree = ""; }; + DA0584DB1E5EE60F006F138F /* Polyline.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Polyline.framework; path = Carthage/Build/watchOS/Polyline.framework; sourceTree = ""; }; DA20FB9B1CE3DEBB00B07762 /* MapboxStatic.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = MapboxStatic.framework; sourceTree = BUILT_PRODUCTS_DIR; }; DA20FB9D1CE3DEBB00B07762 /* MapboxStatic.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MapboxStatic.h; sourceTree = ""; }; DA20FB9F1CE3DEBB00B07762 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; @@ -251,6 +259,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + DA0584D61E5EE5E6006F138F /* Polyline.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -258,6 +267,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + DA0584D81E5EE601006F138F /* Polyline.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -273,6 +283,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + DA0584DA1E5EE60A006F138F /* Polyline.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -288,6 +299,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + DA0584DC1E5EE60F006F138F /* Polyline.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -336,6 +348,10 @@ DA9CC6891E5C550000A14964 /* Frameworks */ = { isa = PBXGroup; children = ( + DA0584DB1E5EE60F006F138F /* Polyline.framework */, + DA0584D91E5EE60A006F138F /* Polyline.framework */, + DA0584D71E5EE601006F138F /* Polyline.framework */, + DA0584D51E5EE5E6006F138F /* Polyline.framework */, DA9CC68E1E5C551500A14964 /* OHHTTPStubs.framework */, DA9CC68C1E5C551000A14964 /* OHHTTPStubs.framework */, DA9CC68A1E5C550000A14964 /* OHHTTPStubs.framework */, @@ -1071,6 +1087,10 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 7; DYLIB_INSTALL_NAME_BASE = "@rpath"; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/iOS", + ); INFOPLIST_FILE = MapboxStatic/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; @@ -1093,6 +1113,10 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 7; DYLIB_INSTALL_NAME_BASE = "@rpath"; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/iOS", + ); INFOPLIST_FILE = MapboxStatic/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; @@ -1116,6 +1140,10 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 7; DYLIB_INSTALL_NAME_BASE = "@rpath"; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/Mac", + ); FRAMEWORK_VERSION = A; INFOPLIST_FILE = MapboxStatic/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; @@ -1141,6 +1169,10 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 7; DYLIB_INSTALL_NAME_BASE = "@rpath"; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/Mac", + ); FRAMEWORK_VERSION = A; INFOPLIST_FILE = MapboxStatic/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; @@ -1203,6 +1235,10 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 7; DYLIB_INSTALL_NAME_BASE = "@rpath"; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/tvOS", + ); INFOPLIST_FILE = "$(SRCROOT)/MapboxStatic/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; @@ -1228,6 +1264,10 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 7; DYLIB_INSTALL_NAME_BASE = "@rpath"; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/tvOS", + ); INFOPLIST_FILE = "$(SRCROOT)/MapboxStatic/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; @@ -1290,6 +1330,10 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 7; DYLIB_INSTALL_NAME_BASE = "@rpath"; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/watchOS", + ); INFOPLIST_FILE = MapboxStatic/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; @@ -1316,6 +1360,10 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 7; DYLIB_INSTALL_NAME_BASE = "@rpath"; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Carthage/Build/watchOS", + ); INFOPLIST_FILE = MapboxStatic/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; diff --git a/MapboxStatic/Overlay.swift b/MapboxStatic/Overlay.swift index fcbde9b..b53b60d 100644 --- a/MapboxStatic/Overlay.swift +++ b/MapboxStatic/Overlay.swift @@ -3,6 +3,7 @@ #else import UIKit #endif +import Polyline let allowedCharacterSet: CharacterSet = { var characterSet = CharacterSet.urlPathAllowed @@ -384,45 +385,8 @@ open class Path: NSObject, Overlay { } } - // based on https://github.com/mapbox/polyline - fileprivate func polylineEncode(_ coordinates: [CLLocationCoordinate2D]) -> String { - - func encodeCoordinate(_ coordinate: CLLocationDegrees) -> String { - - var c = Int(round(coordinate * 1e5)) - - c = c << 1 - - if c < 0 { - c = ~c - } - - var output = "" - - while c >= 0x20 { - output += String(describing: UnicodeScalar((0x20 | (c & 0x1f)) + 63)!) - c = c >> 5 - } - - output += String(describing: UnicodeScalar(c + 63)!) - - return output - } - - var output = encodeCoordinate(coordinates[0].latitude) + encodeCoordinate(coordinates[0].longitude) - - for i in 1 ..< coordinates.count { - let a = coordinates[i] - let b = coordinates[i - 1] - output += encodeCoordinate(a.latitude - b.latitude) - output += encodeCoordinate(a.longitude - b.longitude) - } - - return output - } - open override var description: String { - let encodedPolyline = polylineEncode(coordinates).addingPercentEncoding(withAllowedCharacters: allowedCharacterSet)! + let encodedPolyline = encodeCoordinates(coordinates).addingPercentEncoding(withAllowedCharacters: allowedCharacterSet)! var description = "path-\(strokeWidth)+\(strokeColor.toHexString())-\(strokeColor.alphaComponent)" if fillColor.alphaComponent > 0 { description += "+\(fillColor.toHexString())-\(fillColor.alphaComponent)" From 9a51a002e64cb2812a9fd65789f895bf330fa58a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguye=CC=82=CC=83n?= Date: Sun, 12 Mar 2017 21:17:33 -0700 Subject: [PATCH 2/5] Embed Polyline.framework in test bundles --- MapboxStatic.xcodeproj/project.pbxproj | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/MapboxStatic.xcodeproj/project.pbxproj b/MapboxStatic.xcodeproj/project.pbxproj index 02724e7..7f74b99 100644 --- a/MapboxStatic.xcodeproj/project.pbxproj +++ b/MapboxStatic.xcodeproj/project.pbxproj @@ -130,6 +130,9 @@ DAE8CCC41E6E992E009B5CB0 /* zoom-gl.png in Resources */ = {isa = PBXBuildFile; fileRef = DAE8CCC31E6E992E009B5CB0 /* zoom-gl.png */; }; DAE8CCC51E6E992E009B5CB0 /* zoom-gl.png in Resources */ = {isa = PBXBuildFile; fileRef = DAE8CCC31E6E992E009B5CB0 /* zoom-gl.png */; }; DAE8CCC61E6E992E009B5CB0 /* zoom-gl.png in Resources */ = {isa = PBXBuildFile; fileRef = DAE8CCC31E6E992E009B5CB0 /* zoom-gl.png */; }; + DAA4014D1E7652EE00998ACE /* Polyline.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA0584D51E5EE5E6006F138F /* Polyline.framework */; }; + DAA4014E1E7652F600998ACE /* Polyline.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA0584D71E5EE601006F138F /* Polyline.framework */; }; + DAA4014F1E7652FB00998ACE /* Polyline.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA0584D91E5EE60A006F138F /* Polyline.framework */; }; DAF158881D03E7AC00829B35 /* Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = DAF158871D03E7AC00829B35 /* Launch Screen.storyboard */; }; DAF158891D03E7AC00829B35 /* Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = DAF158871D03E7AC00829B35 /* Launch Screen.storyboard */; }; DAF15A431CE8FBBC0040E86C /* MapboxStatic.h in Headers */ = {isa = PBXBuildFile; fileRef = DA20FB9D1CE3DEBB00B07762 /* MapboxStatic.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -276,6 +279,7 @@ buildActionMask = 2147483647; files = ( DA9CC68D1E5C551000A14964 /* OHHTTPStubs.framework in Frameworks */, + DAA4014E1E7652F600998ACE /* Polyline.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -292,6 +296,7 @@ buildActionMask = 2147483647; files = ( DA9CC68F1E5C551500A14964 /* OHHTTPStubs.framework in Frameworks */, + DAA4014F1E7652FB00998ACE /* Polyline.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -324,6 +329,7 @@ buildActionMask = 2147483647; files = ( DA9CC68B1E5C550000A14964 /* OHHTTPStubs.framework in Frameworks */, + DAA4014D1E7652EE00998ACE /* Polyline.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -901,6 +907,7 @@ ); inputPaths = ( "$(SRCROOT)/Carthage/Build/iOS/OHHTTPStubs.framework", + "$(SRCROOT)/Carthage/Build/iOS/Polyline.framework", ); name = "Copy Frameworks"; outputPaths = ( @@ -916,6 +923,7 @@ ); inputPaths = ( "$(SRCROOT)/Carthage/Build/Mac/OHHTTPStubs.framework", + "$(SRCROOT)/Carthage/Build/Mac/Polyline.framework", ); name = "Copy Frameworks"; outputPaths = ( @@ -931,6 +939,7 @@ ); inputPaths = ( "$(SRCROOT)/Carthage/Build/tvOS/OHHTTPStubs.framework", + "$(SRCROOT)/Carthage/Build/tvOS/Polyline.framework", ); name = "Copy Frameworks"; outputPaths = ( From 45f66af87a94f036e1daa8eca594ff82404f2119 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguye=CC=82=CC=83n?= Date: Sun, 12 Mar 2017 21:18:29 -0700 Subject: [PATCH 3/5] Updated encoded polyline test fixture MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Polyline.framework encodes the polyline slightly differently, but there doesn’t appear to be any discernible difference in the output image. --- MapboxStaticTests/ClassicOverlayTests.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MapboxStaticTests/ClassicOverlayTests.swift b/MapboxStaticTests/ClassicOverlayTests.swift index 8354b93..439faf1 100644 --- a/MapboxStaticTests/ClassicOverlayTests.swift +++ b/MapboxStaticTests/ClassicOverlayTests.swift @@ -140,7 +140,7 @@ class ClassicOverlayTests: XCTestCase { options.overlays = [path] options.scale = 1 - let encodedPolyline = "upztG`jxkVn@al@bo@nFWzuAaTcAyZen@" + let encodedPolyline = "upztG`jxkVn@al@bo@pFWzuAaTcAyZgn@" stub(condition: isHost("api.mapbox.com") && isPath("/v4/mapbox.streets/path-2+000000-0.75+ff0000-0.25(\(encodedPolyline))/auto/200x200.png") From d280f4fdb490e5f7192ebfc564ca89078faba4a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguye=CC=82=CC=83n?= Date: Sun, 12 Mar 2017 21:26:57 -0700 Subject: [PATCH 4/5] Embed MapboxStatic in example applications --- MapboxStatic.xcodeproj/project.pbxproj | 39 +++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/MapboxStatic.xcodeproj/project.pbxproj b/MapboxStatic.xcodeproj/project.pbxproj index 7f74b99..343970d 100644 --- a/MapboxStatic.xcodeproj/project.pbxproj +++ b/MapboxStatic.xcodeproj/project.pbxproj @@ -96,7 +96,6 @@ DA0584DA1E5EE60A006F138F /* Polyline.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA0584D91E5EE60A006F138F /* Polyline.framework */; }; DA0584DC1E5EE60F006F138F /* Polyline.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA0584DB1E5EE60F006F138F /* Polyline.framework */; }; DA20FB9E1CE3DEBB00B07762 /* MapboxStatic.h in Headers */ = {isa = PBXBuildFile; fileRef = DA20FB9D1CE3DEBB00B07762 /* MapboxStatic.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DA20FBA21CE3DEBB00B07762 /* MapboxStatic.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA20FB9B1CE3DEBB00B07762 /* MapboxStatic.framework */; }; DA20FBA81CE3DF6900B07762 /* Snapshot.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDAD19871BD9B3970057AC9F /* Snapshot.swift */; }; DA20FBAA1CE401E800B07762 /* Color.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA20FBA91CE401E800B07762 /* Color.swift */; }; DA20FBAC1CE4026B00B07762 /* Overlay.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA20FBAB1CE4026B00B07762 /* Overlay.swift */; }; @@ -133,6 +132,10 @@ DAA4014D1E7652EE00998ACE /* Polyline.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA0584D51E5EE5E6006F138F /* Polyline.framework */; }; DAA4014E1E7652F600998ACE /* Polyline.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA0584D71E5EE601006F138F /* Polyline.framework */; }; DAA4014F1E7652FB00998ACE /* Polyline.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA0584D91E5EE60A006F138F /* Polyline.framework */; }; + DAA401531E7656B900998ACE /* MapboxStatic.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA20FB9B1CE3DEBB00B07762 /* MapboxStatic.framework */; }; + DAA401541E7656B900998ACE /* MapboxStatic.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = DA20FB9B1CE3DEBB00B07762 /* MapboxStatic.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + DAA401561E7656F000998ACE /* MapboxStatic.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA20FB9B1CE3DEBB00B07762 /* MapboxStatic.framework */; }; + DAA401571E7656F000998ACE /* MapboxStatic.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = DA20FB9B1CE3DEBB00B07762 /* MapboxStatic.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; DAF158881D03E7AC00829B35 /* Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = DAF158871D03E7AC00829B35 /* Launch Screen.storyboard */; }; DAF158891D03E7AC00829B35 /* Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = DAF158871D03E7AC00829B35 /* Launch Screen.storyboard */; }; DAF15A431CE8FBBC0040E86C /* MapboxStatic.h in Headers */ = {isa = PBXBuildFile; fileRef = DA20FB9D1CE3DEBB00B07762 /* MapboxStatic.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -142,7 +145,6 @@ DAF15A4F1CE90A6C0040E86C /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = DAF15A4E1CE90A6C0040E86C /* main.m */; }; DAF15A521CE90A6C0040E86C /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = DAF15A511CE90A6C0040E86C /* AppDelegate.m */; }; DAF15A551CE90A6C0040E86C /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = DAF15A541CE90A6C0040E86C /* ViewController.m */; }; - DAF15A631CE90CE70040E86C /* MapboxStatic.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA20FB9B1CE3DEBB00B07762 /* MapboxStatic.framework */; }; DD0C88181BE1A9E100606E9F /* polyline.geojson in Resources */ = {isa = PBXBuildFile; fileRef = DD0C88161BE1A9D400606E9F /* polyline.geojson */; }; DD685BA91BDB14C1002E2BB2 /* MapboxStaticTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDAD19831BD9B2F80057AC9F /* MapboxStaticTests.swift */; }; DDAD19711BD9B1A50057AC9F /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDAD196E1BD9B1A50057AC9F /* AppDelegate.swift */; }; @@ -187,6 +189,31 @@ }; /* End PBXContainerItemProxy section */ +/* Begin PBXCopyFilesBuildPhase section */ + DAA401551E7656B900998ACE /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + DAA401541E7656B900998ACE /* MapboxStatic.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; + DAA401581E7656F000998ACE /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + DAA401571E7656F000998ACE /* MapboxStatic.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + /* Begin PBXFileReference section */ DA031C611E6F4824007CA06A /* rotate.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = rotate.png; sourceTree = ""; }; DA031C651E6F487E007CA06A /* tilt.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = tilt.png; sourceTree = ""; }; @@ -312,7 +339,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - DAF15A631CE90CE70040E86C /* MapboxStatic.framework in Frameworks */, + DAA401561E7656F000998ACE /* MapboxStatic.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -320,7 +347,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - DA20FBA21CE3DEBB00B07762 /* MapboxStatic.framework in Frameworks */, + DAA401531E7656B900998ACE /* MapboxStatic.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -629,6 +656,7 @@ DAF15A471CE90A6C0040E86C /* Sources */, DAF15A481CE90A6C0040E86C /* Frameworks */, DAF15A491CE90A6C0040E86C /* Resources */, + DAA401581E7656F000998ACE /* Embed Frameworks */, ); buildRules = ( ); @@ -647,6 +675,7 @@ DDAD19551BD9B1780057AC9F /* Sources */, DDAD19561BD9B1780057AC9F /* Frameworks */, DDAD19571BD9B1780057AC9F /* Resources */, + DAA401551E7656B900998ACE /* Embed Frameworks */, ); buildRules = ( ); @@ -1509,6 +1538,7 @@ DDAD196C1BD9B1780057AC9F /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; CURRENT_PROJECT_VERSION = 7; INFOPLIST_FILE = "$(SRCROOT)/Example/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; @@ -1522,6 +1552,7 @@ DDAD196D1BD9B1780057AC9F /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; CURRENT_PROJECT_VERSION = 7; INFOPLIST_FILE = "$(SRCROOT)/Example/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; From 179016cd4ccfa94f8fe61b9d73de04d8a65a239d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguye=CC=82=CC=83n?= Date: Tue, 21 Nov 2017 13:49:25 -0800 Subject: [PATCH 5/5] Updated tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In the iOS 11 and macOS 10.13 SDKs, JSONSerialization adds an extra digit of precision. Also, in the macOS 10.13 SDK, the RGB components of NSColor’s class properties differ from those of UIColor’s similarly named class properties. --- MapboxStaticTests/ClassicOverlayTests.swift | 19 +++++++++++++++---- MapboxStaticTests/ClassicSnapshotTests.swift | 8 +++++++- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/MapboxStaticTests/ClassicOverlayTests.swift b/MapboxStaticTests/ClassicOverlayTests.swift index 439faf1..04d7bed 100644 --- a/MapboxStaticTests/ClassicOverlayTests.swift +++ b/MapboxStaticTests/ClassicOverlayTests.swift @@ -29,8 +29,14 @@ class ClassicOverlayTests: XCTestCase { options.overlays = [markerOverlay] options.scale = 1 + let hexColor: String + #if os(macOS) + hexColor = "865226" + #else + hexColor = "996633" + #endif stub(condition: isHost("api.mapbox.com") - && isPath("/v4/mapbox.streets/pin-m-cafe+996633(-122.681944,45.52)/auto/200x200.png") + && isPath("/v4/mapbox.streets/pin-m-cafe+\(hexColor)(-122.681944,45.52)/auto/200x200.png") && containsQueryParams(["access_token": BogusToken])) { request in let path = Bundle(for: type(of: self)).path(forResource: "marker", ofType: "png")! return fixture(filePath: path, headers: ["Content-Type": "image/png"]) @@ -96,7 +102,7 @@ class ClassicOverlayTests: XCTestCase { options.overlays = [geoJSONOverlay] options.scale = 1 - let geoJSONString = "{\"type\":\"FeatureCollection\",\"features\":[{\"type\":\"Feature\",\"properties\":{\"stroke-width\":3,\"stroke-opacity\":1,\"stroke\":\"#00f\"},\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-122.6978445053101,45.51863175803531],[-122.6909136772156,45.52165369248977],[-122.68630027771,45.51891742047702],[-122.6850986480713,45.51631633525551],[-122.6823306083679,45.51950377568216]]}}]}" + let geoJSONString = "{\"type\":\"FeatureCollection\",\"features\":[{\"type\":\"Feature\",\"properties\":{\"stroke-width\":3,\"stroke-opacity\":1,\"stroke\":\"#00f\"},\"geometry\":{\"type\":\"LineString\",\"coordinates\":[[-122.69784450531006,45.518631758035312],[-122.69091367721559,45.521653692489771],[-122.68630027770996,45.518917420477024],[-122.68509864807127,45.51631633525551],[-122.68233060836793,45.519503775682161]]}}]}" stub(condition: isHost("api.mapbox.com") && isPath("/v4/mapbox.streets/geojson(\(geoJSONString))/auto/200x200.png") @@ -140,10 +146,15 @@ class ClassicOverlayTests: XCTestCase { options.overlays = [path] options.scale = 1 + let hexColor: String + #if os(macOS) + hexColor = "fb0006" + #else + hexColor = "ff0000" + #endif let encodedPolyline = "upztG`jxkVn@al@bo@pFWzuAaTcAyZgn@" - stub(condition: isHost("api.mapbox.com") - && isPath("/v4/mapbox.streets/path-2+000000-0.75+ff0000-0.25(\(encodedPolyline))/auto/200x200.png") + && isPath("/v4/mapbox.streets/path-2+000000-0.75+\(hexColor)-0.25(\(encodedPolyline))/auto/200x200.png") && containsQueryParams(["access_token": BogusToken])) { request in let path = Bundle(for: type(of: self)).path(forResource: "path", ofType: "png")! return fixture(filePath: path, headers: ["Content-Type": "image/png"]) diff --git a/MapboxStaticTests/ClassicSnapshotTests.swift b/MapboxStaticTests/ClassicSnapshotTests.swift index 54c2cd3..6cd79c0 100644 --- a/MapboxStaticTests/ClassicSnapshotTests.swift +++ b/MapboxStaticTests/ClassicSnapshotTests.swift @@ -166,8 +166,14 @@ class ClassicSnapshotTests: XCTestCase { options.color = .brown options.scale = 1 + let hexColor: String + #if os(macOS) + hexColor = "865226" + #else + hexColor = "996633" + #endif stub(condition: isHost("api.mapbox.com") - && isPath("/v4/marker/pin-m-cafe+996633.png") + && isPath("/v4/marker/pin-m-cafe+\(hexColor).png") && containsQueryParams(["access_token": BogusToken])) { request in let path = Bundle(for: type(of: self)).path(forResource: "cafe", ofType: "png")! return fixture(filePath: path, headers: ["Content-Type": "image/png"])