From f18fe4dc2539f820a437e4ae2d473dc5b5c694b9 Mon Sep 17 00:00:00 2001 From: Jack Alto <384288+aokj4ck@users.noreply.github.com> Date: Wed, 31 Jan 2024 19:16:48 -0500 Subject: [PATCH 1/3] Prepare 2.0.0 release (#160) * Prepare 2.0.0 release * Bump app version number for Demo and Example projects --- CHANGELOG.md | 2 ++ Examples/SearchExamples.xcodeproj/project.pbxproj | 4 ++-- MapboxSearch.podspec | 2 +- MapboxSearch.xcodeproj/project.pbxproj | 4 ++-- MapboxSearchUI.podspec | 4 ++-- README.md | 8 ++++---- Search Documentation.docc/Installation.md | 4 ++-- Sources/MapboxSearch/PublicAPI/MapboxSearchVersion.swift | 2 +- 8 files changed, 16 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 41f04cd67..a72573256 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ Guide: https://keepachangelog.com/en/1.0.0/ +## 2.0.0 + - [Discover] Fix charging station category canonical ID - [SearchUI] Rename MapboxPanelController.Configuration to .PanelConfiguration. This disambiguates PanelConfiguration from the broader Configuration struct. - [Core] Update SwiftLint to 0.54.0 and SwiftFormat to 0.52.11 diff --git a/Examples/SearchExamples.xcodeproj/project.pbxproj b/Examples/SearchExamples.xcodeproj/project.pbxproj index db0b539dd..29f5bb320 100644 --- a/Examples/SearchExamples.xcodeproj/project.pbxproj +++ b/Examples/SearchExamples.xcodeproj/project.pbxproj @@ -389,7 +389,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.0; + MARKETING_VERSION = 2.0.0; PRODUCT_BUNDLE_IDENTIFIER = com.mapbox.SearchExamples; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; @@ -408,7 +408,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.0; + MARKETING_VERSION = 2.0.0; PRODUCT_BUNDLE_IDENTIFIER = com.mapbox.SearchExamples; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; diff --git a/MapboxSearch.podspec b/MapboxSearch.podspec index 72b0875b4..c9dde8844 100644 --- a/MapboxSearch.podspec +++ b/MapboxSearch.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'MapboxSearch' - s.version = '2.0.0-alpha.1' + s.version = '2.0.0' s.summary = 'Search SDK for Mapbox Search API ' # This description is used to generate tags and improve search results. diff --git a/MapboxSearch.xcodeproj/project.pbxproj b/MapboxSearch.xcodeproj/project.pbxproj index f6dd3380f..c1cba4cda 100644 --- a/MapboxSearch.xcodeproj/project.pbxproj +++ b/MapboxSearch.xcodeproj/project.pbxproj @@ -3106,7 +3106,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.0; + MARKETING_VERSION = 2.0.0; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.mapbox.MapboxSearchDemoApplication; @@ -3131,7 +3131,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.0; + MARKETING_VERSION = 2.0.0; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.mapbox.MapboxSearchDemoApplication; diff --git a/MapboxSearchUI.podspec b/MapboxSearchUI.podspec index 60c8bb2d6..0b9408fda 100644 --- a/MapboxSearchUI.podspec +++ b/MapboxSearchUI.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'MapboxSearchUI' - s.version = '2.0.0-alpha.1' + s.version = '2.0.0' s.summary = 'Search UI for Mapbox Search API' # This description is used to generate tags and improve search results. @@ -23,5 +23,5 @@ Card style custom UI with full search functionality powered by Mapbox Search API s.vendored_frameworks = "**/#{s.name}.xcframework" - s.dependency 'MapboxSearch', "2.0.0-alpha.1" + s.dependency 'MapboxSearch', "2.0.0" end diff --git a/README.md b/README.md index 80c507ff4..e7c68d684 100644 --- a/README.md +++ b/README.md @@ -82,8 +82,8 @@ Once you've installed the prerequisites, no additional steps are needed: Open th You can find the following documentation pages helpful: - [Search SDK for iOS guide](https://docs.mapbox.com/ios/search/guides/) -- [MapboxSearch reference](https://docs.mapbox.com/ios/search/api/core/2.0.0-alpha.1/) -- [MapboxSearchUI reference](https://docs.mapbox.com/ios/search/api/ui/2.0.0-alpha.1/) +- [MapboxSearch reference](https://docs.mapbox.com/ios/search/api/core/2.0.0/) +- [MapboxSearchUI reference](https://docs.mapbox.com/ios/search/api/ui/2.0.0/) ## Project structure overview @@ -108,13 +108,13 @@ MapboxSearchDemoApplication provides a Demo app wih MapboxSearchUI.framework pre ##### MapboxSearch To integrate latest preview version of `MapboxSearch` into your Xcode project using CocoaPods, specify it in your `Podfile`: ``` -pod 'MapboxSearch', ">= 2.0.0-alpha.1", "< 3.0" +pod 'MapboxSearch', ">= 2.0.0", "< 3.0" ``` ##### MapboxSearchUI To integrate latest preview version of `MapboxSearchUI` into your Xcode project using CocoaPods, specify it in your `Podfile`: ``` -pod 'MapboxSearchUI', ">= 2.0.0-alpha.1", "< 3.0" +pod 'MapboxSearchUI', ">= 2.0.0", "< 3.0" ``` ### Swift Package Manager diff --git a/Search Documentation.docc/Installation.md b/Search Documentation.docc/Installation.md index f2161f045..486ba6f30 100644 --- a/Search Documentation.docc/Installation.md +++ b/Search Documentation.docc/Installation.md @@ -59,7 +59,7 @@ To add the Mapbox Search SDK dependency with CocoaPods, you will need to configu ```ruby use_frameworks! target "TargetNameForYourApp" do - pod 'MapboxSearchUI', ">= 2.0.0-alpha.1", "< 3.0" + pod 'MapboxSearchUI', ">= 2.0.0", "< 3.0" end ``` @@ -68,7 +68,7 @@ To add the Mapbox Search SDK dependency with CocoaPods, you will need to configu ```ruby use_frameworks! target "TargetNameForYourApp" do - pod 'MapboxSearch', ">= 2.0.0-alpha.1", "< 3.0" + pod 'MapboxSearch', ">= 2.0.0", "< 3.0" end ``` diff --git a/Sources/MapboxSearch/PublicAPI/MapboxSearchVersion.swift b/Sources/MapboxSearch/PublicAPI/MapboxSearchVersion.swift index 8ccf4a2c8..b21ef2130 100644 --- a/Sources/MapboxSearch/PublicAPI/MapboxSearchVersion.swift +++ b/Sources/MapboxSearch/PublicAPI/MapboxSearchVersion.swift @@ -1,2 +1,2 @@ /// Mapbox Search SDK version variable -public let mapboxSearchSDKVersion = "1.0.0-rc.8" +public let mapboxSearchSDKVersion = "2.0.0" From b7796279a915f35da6f64d0a39291574e9611dbf Mon Sep 17 00:00:00 2001 From: Jack Alto <384288+aokj4ck@users.noreply.github.com> Date: Fri, 2 Feb 2024 14:32:54 -0500 Subject: [PATCH 2/3] Check for exact version matches (inside double-quotes) during pre-release check (#169) ### Description - Fix release-pre-check CircleCI step to check for exact version matches (inside double-quotes) during pre-release check - The previous behavior would for any semvar release without a suffix if any suffix is published (ex: 2.0.0 fails because 2.0.0-alpha.1 is published) - This fix will correct the behavior by searching for `"2.0.0"` which will not match against `"2.0.0-alpha.1"` ### Checklist - [N/A] Update `CHANGELOG` --- .circleci/config.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index df5352869..fa6248adf 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -87,7 +87,8 @@ jobs: - parse-release-version - run: name: Check existing public release - command: curl -L https://api.mapbox.com/downloads/v2/carthage/search-sdk/MapboxSearch.json | grep -v "$VERSION" + # Escape the quotes to check for exact versions + command: curl -L https://api.mapbox.com/downloads/v2/carthage/search-sdk/MapboxSearch.json | grep -v \"$VERSION\" build: macos: From 742cf38508d6f072d689a1c067199ddab4fcd31d Mon Sep 17 00:00:00 2001 From: Jack Alto <384288+aokj4ck@users.noreply.github.com> Date: Mon, 5 Feb 2024 14:15:01 -0500 Subject: [PATCH 3/3] [SSDK-544] Replace supportSBS binary with expandable ApiType enum (#162) ### Description Fixes [SSDK-544](https://mapbox.atlassian.net/browse/SSDK-544) - Change AbstractSearchEngine.init `supportSBS: Bool = false` parameter to `apiType: ApiType = .SBS`. - This changes the default API engine for discover/category and other API requests to SBS. - Add ApiType enum to represent non-Autofill and non-PlaceAutocomplete SearchEngine API types. - This will be expanded to include the new [search-box](https://docs.mapbox.com/api/search/search-box/) API type ### Checklist - [x] Update `CHANGELOG` [SSDK-544]: https://mapbox.atlassian.net/browse/SSDK-544 --- CHANGELOG.md | 4 +++- MapboxSearch.xcodeproj/project.pbxproj | 16 ++++++++++++++++ .../InternalAPI/Engine/ApiType+Core.swift | 14 ++++++++++++++ .../Engine/AbstractSearchEngine.swift | 18 +++++++++--------- .../PublicAPI/Engine/ApiType.swift | 12 ++++++++++++ .../Use Cases/Discover API/Discover.swift | 2 +- .../MapboxSearchController.swift | 2 +- .../CategorySearchEngineIntegrationTests.swift | 2 +- .../PlaceAutocompleteIntegrationTests.swift | 9 ++++++--- .../SearchEngineIntegrationTests.swift | 2 +- 10 files changed, 64 insertions(+), 17 deletions(-) create mode 100644 Sources/MapboxSearch/InternalAPI/Engine/ApiType+Core.swift create mode 100644 Sources/MapboxSearch/PublicAPI/Engine/ApiType.swift diff --git a/CHANGELOG.md b/CHANGELOG.md index a72573256..0c92f271e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,9 @@ Guide: https://keepachangelog.com/en/1.0.0/ -## 2.0.0 +- [Core] Change AbstractSearchEngine.init `supportSBS: Bool = false` parameter to `apiType: ApiType = .SBS`. This changes the default API engine for discover/category and other API requests to SBS. Add ApiType enum to represent non-Autofill and non-PlaceAutocomplete SearchEngine API types. + +## 2.0.0-rc.1 - [Discover] Fix charging station category canonical ID - [SearchUI] Rename MapboxPanelController.Configuration to .PanelConfiguration. This disambiguates PanelConfiguration from the broader Configuration struct. diff --git a/MapboxSearch.xcodeproj/project.pbxproj b/MapboxSearch.xcodeproj/project.pbxproj index c1cba4cda..a8b19339b 100644 --- a/MapboxSearch.xcodeproj/project.pbxproj +++ b/MapboxSearch.xcodeproj/project.pbxproj @@ -9,6 +9,8 @@ /* Begin PBXBuildFile section */ 043A3D4D2B30F38300DB681B /* CoreAddress+AddressComponents.swift in Sources */ = {isa = PBXBuildFile; fileRef = 043A3D4C2B30F38300DB681B /* CoreAddress+AddressComponents.swift */; }; 04C0848D2B4C82F3002F9C69 /* SdkInformation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04C0848C2B4C82F3002F9C69 /* SdkInformation.swift */; }; + 04C127552B62F6BC00884325 /* ApiType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04C127542B62F6BC00884325 /* ApiType.swift */; }; + 04C127582B62FFDB00884325 /* ApiType+Core.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04C127572B62FFDB00884325 /* ApiType+Core.swift */; }; 04E5FF962B48828500DADC18 /* SearchAddressCountry.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04E5FF952B48828500DADC18 /* SearchAddressCountry.swift */; }; 04E5FF992B48829200DADC18 /* SearchAddressRegion.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04E5FF982B48829200DADC18 /* SearchAddressRegion.swift */; }; 140D1BDC286DB479001A51C2 /* SearchResultAccuracy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 140D1BDB286DB479001A51C2 /* SearchResultAccuracy.swift */; }; @@ -481,6 +483,8 @@ /* Begin PBXFileReference section */ 043A3D4C2B30F38300DB681B /* CoreAddress+AddressComponents.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CoreAddress+AddressComponents.swift"; sourceTree = ""; }; 04C0848C2B4C82F3002F9C69 /* SdkInformation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SdkInformation.swift; sourceTree = ""; }; + 04C127542B62F6BC00884325 /* ApiType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ApiType.swift; sourceTree = ""; }; + 04C127572B62FFDB00884325 /* ApiType+Core.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ApiType+Core.swift"; sourceTree = ""; }; 04E5FF952B48828500DADC18 /* SearchAddressCountry.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SearchAddressCountry.swift; sourceTree = ""; }; 04E5FF982B48829200DADC18 /* SearchAddressRegion.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SearchAddressRegion.swift; sourceTree = ""; }; 140D1BDB286DB479001A51C2 /* SearchResultAccuracy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchResultAccuracy.swift; sourceTree = ""; }; @@ -897,6 +901,14 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 04C127562B62FFD000884325 /* Engine */ = { + isa = PBXGroup; + children = ( + 04C127572B62FFDB00884325 /* ApiType+Core.swift */, + ); + path = Engine; + sourceTree = ""; + }; 04E5FF972B48829200DADC18 /* Region */ = { isa = PBXGroup; children = ( @@ -1364,6 +1376,7 @@ isa = PBXGroup; children = ( FEEDD2E32508DFE400DC0A98 /* AbstractSearchEngine.swift */, + 04C127542B62F6BC00884325 /* ApiType.swift */, FEEDD2D82508DFE400DC0A98 /* SearchEngine.swift */, FEEDD2EB2508DFE400DC0A98 /* CategorySearchEngine.swift */, 04C0848C2B4C82F3002F9C69 /* SdkInformation.swift */, @@ -1546,6 +1559,7 @@ FEEDD2C12508DFE400DC0A98 /* InternalAPI */ = { isa = PBXGroup; children = ( + 04C127562B62FFD000884325 /* Engine */, 148DE66E285777050085684D /* Common */, F98BECBB2577B9150081D3BC /* Telemetry */, FEEDD2C32508DFE400DC0A98 /* Array+Extensions.swift */, @@ -2350,6 +2364,7 @@ F93DA6FF274E4B86005595B5 /* CoreSearchEngineStatics.swift in Sources */, 14F71865299FD4BD00D5BC2E /* PlaceAutocomplete+PlaceType.swift in Sources */, F9F6378A25DD6A4E00C99904 /* FeedbackManager.swift in Sources */, + 04C127582B62FFDB00884325 /* ApiType+Core.swift in Sources */, 148DE65D28574E6E0085684D /* AddressAutofill.swift in Sources */, 140E47A7298BCBDF00677E30 /* Discover+Query.swift in Sources */, FEEDD3092508DFE400DC0A98 /* CodablePersistentService.swift in Sources */, @@ -2443,6 +2458,7 @@ FEEDD3152508DFE400DC0A98 /* ServerSearchResult.swift in Sources */, 140E47A2298BC90E00677E30 /* Discover.swift in Sources */, 14FA65872953644400056E5B /* PlaceAutocomplete+Suggestion.swift in Sources */, + 04C127552B62F6BC00884325 /* ApiType.swift in Sources */, FE059C5A251A0AE6001F7701 /* SearchCategorySuggestionImpl.swift in Sources */, FEEDD2F62508DFE400DC0A98 /* CoreSearchResultResponse.swift in Sources */, FE260A6725C063880037B725 /* ReverseGeocodingOptions.swift in Sources */, diff --git a/Sources/MapboxSearch/InternalAPI/Engine/ApiType+Core.swift b/Sources/MapboxSearch/InternalAPI/Engine/ApiType+Core.swift new file mode 100644 index 000000000..6040f3579 --- /dev/null +++ b/Sources/MapboxSearch/InternalAPI/Engine/ApiType+Core.swift @@ -0,0 +1,14 @@ +// Copyright © 2024 Mapbox. All rights reserved. + +import Foundation + +extension ApiType { + func toCore() -> CoreSearchEngine.ApiType { + switch self { + case .geocoding: + return .geocoding + case .SBS: + return .SBS + } + } +} diff --git a/Sources/MapboxSearch/PublicAPI/Engine/AbstractSearchEngine.swift b/Sources/MapboxSearch/PublicAPI/Engine/AbstractSearchEngine.swift index 41051d23d..a5a4ecba8 100644 --- a/Sources/MapboxSearch/PublicAPI/Engine/AbstractSearchEngine.swift +++ b/Sources/MapboxSearch/PublicAPI/Engine/AbstractSearchEngine.swift @@ -20,8 +20,8 @@ public class AbstractSearchEngine: FeedbackManagerDelegate { var locationProviderWrapper: WrapperLocationProvider? - /// SearchEngine supports the latest Single-Box Search APIs - public let supportSBS: Bool + /// Provide a specific API type + public let apiType: ApiType /// Location provider for search results `proximity` argument public let locationProvider: LocationProvider? @@ -54,13 +54,13 @@ public class AbstractSearchEngine: FeedbackManagerDelegate { /// - locationProvider: Provider configuration of LocationProvider that would grant location data by default /// - serviceProvider: Internal `ServiceProvider` for sharing common dependencies like favoritesService or /// eventsManager - /// - supportSBS: enable support the latest Single-Box Search APIs + /// - apiType: choose which API provider to use through this search engine init( accessToken: String? = nil, serviceProvider: ServiceProviderProtocol & EngineProviderProtocol, locationProvider: LocationProvider? = DefaultLocationProvider(), defaultSearchOptions: SearchOptions = SearchOptions(), - supportSBS: Bool = false + apiType: ApiType = .SBS ) { guard let accessToken = accessToken ?? serviceProvider.getStoredAccessToken() else { fatalError( @@ -68,13 +68,13 @@ public class AbstractSearchEngine: FeedbackManagerDelegate { ) } - self.supportSBS = supportSBS self.locationProvider = locationProvider self.locationProviderWrapper = WrapperLocationProvider(wrapping: locationProvider) self.eventsManager = serviceProvider.eventsManager self.feedbackManager = serviceProvider.feedbackManager self.defaultSearchOptions = defaultSearchOptions - self.engineApi = supportSBS ? .SBS : .geocoding + self.apiType = apiType + self.engineApi = apiType.toCore() self.userActivityReporter = .getOrCreate( for: .init( @@ -110,19 +110,19 @@ public class AbstractSearchEngine: FeedbackManagerDelegate { /// for `nil` argument /// - locationProvider: Provider configuration of LocationProvider that would grant location data by default /// - defaultSearchOptions: Default options to use when `nil` was passed to the `search(…: options:)` call - /// - supportSBS: enable support the latest Single-Box Search APIs + /// - apiType: choose which API provider to use through this search engine public convenience init( accessToken: String? = nil, locationProvider: LocationProvider? = DefaultLocationProvider(), defaultSearchOptions: SearchOptions = SearchOptions(), - supportSBS: Bool = false + apiType: ApiType = .SBS ) { self.init( accessToken: accessToken, serviceProvider: ServiceProvider.shared, locationProvider: locationProvider, defaultSearchOptions: defaultSearchOptions, - supportSBS: supportSBS + apiType: apiType ) } diff --git a/Sources/MapboxSearch/PublicAPI/Engine/ApiType.swift b/Sources/MapboxSearch/PublicAPI/Engine/ApiType.swift new file mode 100644 index 000000000..b2696f173 --- /dev/null +++ b/Sources/MapboxSearch/PublicAPI/Engine/ApiType.swift @@ -0,0 +1,12 @@ +// Copyright © 2024 Mapbox. All rights reserved. + +import Foundation + +/// Determine which Mapbox API to use for a SearchEngine instance +public enum ApiType { + /// The Mapbox Geocoding (a.k.a V5) API - https://docs.mapbox.com/api/search/geocoding/ + case geocoding + + /// The Mapbox Single Box Search (a.k.a Federation API) - https://docs.mapbox.com/api/search/search/ + case SBS +} diff --git a/Sources/MapboxSearch/PublicAPI/Use Cases/Discover API/Discover.swift b/Sources/MapboxSearch/PublicAPI/Use Cases/Discover API/Discover.swift index 0e1818670..591116950 100644 --- a/Sources/MapboxSearch/PublicAPI/Use Cases/Discover API/Discover.swift +++ b/Sources/MapboxSearch/PublicAPI/Use Cases/Discover API/Discover.swift @@ -23,7 +23,7 @@ public final class Discover { let searchEngine = CategorySearchEngine( accessToken: accessToken, locationProvider: locationProvider, - supportSBS: true + apiType: .SBS ) let userActivityReporter = CoreUserActivityReporter.getOrCreate( diff --git a/Sources/MapboxSearchUI/MapboxSearchController.swift b/Sources/MapboxSearchUI/MapboxSearchController.swift index e133df993..100486f92 100644 --- a/Sources/MapboxSearchUI/MapboxSearchController.swift +++ b/Sources/MapboxSearchUI/MapboxSearchController.swift @@ -636,7 +636,7 @@ extension MapboxSearchController: SearchCategoriesRootViewDelegate { } func userSelectedCategory(_ category: SearchCategory) { - let categoryName = categorySearchEngine.supportSBS ? category.canonicalId : category.legacyName + let categoryName = categorySearchEngine.apiType == .geocoding ? category.legacyName : category.canonicalId categorySearchEngine.search(categoryName: categoryName, options: categorySearchOptions) { results in switch results { diff --git a/Tests/MapboxSearchIntegrationTests/CategorySearchEngineIntegrationTests.swift b/Tests/MapboxSearchIntegrationTests/CategorySearchEngineIntegrationTests.swift index cc6c244a6..2b58448e8 100644 --- a/Tests/MapboxSearchIntegrationTests/CategorySearchEngineIntegrationTests.swift +++ b/Tests/MapboxSearchIntegrationTests/CategorySearchEngineIntegrationTests.swift @@ -6,7 +6,7 @@ class CategorySearchEngineIntegrationTests: MockServerTestCase { lazy var searchEngine = CategorySearchEngine( accessToken: "access-token", locationProvider: DefaultLocationProvider(), - supportSBS: true + apiType: .SBS ) func testCategorySearch() throws { diff --git a/Tests/MapboxSearchIntegrationTests/PlaceAutocompleteIntegrationTests.swift b/Tests/MapboxSearchIntegrationTests/PlaceAutocompleteIntegrationTests.swift index f1bc264f6..9a5f94359 100644 --- a/Tests/MapboxSearchIntegrationTests/PlaceAutocompleteIntegrationTests.swift +++ b/Tests/MapboxSearchIntegrationTests/PlaceAutocompleteIntegrationTests.swift @@ -38,7 +38,8 @@ final class PlaceAutocompleteIntegrationTests: MockServerTestCase { wait(for: [expectation], timeout: 5) let selectionExpectation = XCTestExpectation(description: "Expecting selection result") - placeAutocomplete.select(suggestion: suggestion!) { result in + let unwrappedSuggestion = try XCTUnwrap(suggestion) + placeAutocomplete.select(suggestion: unwrappedSuggestion) { result in switch result { case .success(let resolvedSuggestion): XCTAssertEqual(resolvedSuggestion.name, "San Francisco") @@ -92,7 +93,8 @@ final class PlaceAutocompleteIntegrationTests: MockServerTestCase { try server.setResponse(.retrieveMinsk) let selectionExpectation = XCTestExpectation(description: "Expecting selection result") - placeAutocomplete.select(suggestion: suggestion!) { result in + let unwrappedSuggestion = try XCTUnwrap(suggestion) + placeAutocomplete.select(suggestion: unwrappedSuggestion) { result in switch result { case .success(let resolvedSuggestion): XCTAssertEqual(resolvedSuggestion.name, "Minsk") @@ -225,7 +227,8 @@ final class PlaceAutocompleteIntegrationTests: MockServerTestCase { try server.setResponse(.retrievePoi) let selectionExpectation = XCTestExpectation(description: "Expecting selection result") - placeAutocomplete.select(suggestion: suggestion!) { result in + let unwrappedSuggestion = try XCTUnwrap(suggestion) + placeAutocomplete.select(suggestion: unwrappedSuggestion) { result in switch result { case .success(let resolvedSuggestion): XCTAssertEqual(resolvedSuggestion.name, "Starbucks") diff --git a/Tests/MapboxSearchIntegrationTests/SearchEngineIntegrationTests.swift b/Tests/MapboxSearchIntegrationTests/SearchEngineIntegrationTests.swift index effe6fbeb..b52ea86d1 100644 --- a/Tests/MapboxSearchIntegrationTests/SearchEngineIntegrationTests.swift +++ b/Tests/MapboxSearchIntegrationTests/SearchEngineIntegrationTests.swift @@ -7,7 +7,7 @@ class SearchEngineIntegrationTests: MockServerTestCase { lazy var searchEngine = SearchEngine( accessToken: "access-token", locationProvider: DefaultLocationProvider(), - supportSBS: true + apiType: .SBS ) override func setUpWithError() throws {