合併是 這個架構可用於結合事件處理運算子來處理非同步事件。 合併功能可讓您集中處理事件處理程式碼,以便讀取及維護程式碼。
GoogleMapsPlatformCombine 程式庫
這個 Swift 程式庫會傳回
Publishers敬上
Maps SDK for iOS 和 Places SDK for iOS 版本,這樣您就能
更豐富的「合併」功能組合
安裝
查看 GoogleMapsPlatformCombine 程式庫 說明文件,瞭解最新系統需求和安裝操作說明。使用範例
GoogleMapsPlatformCombine 程式庫提供擴充項目,
傳回的 GMSPlacesClient 類別
Future。
Places API 呼叫的發布商。
以下範例使用 fetchPlace(id:, fields:, sessionToken:) -> Future<GMSPlace, Error>
用於擷取 Place Details 的擴充功能:
GMSPlacesClient.shared() .fetchPlace( id: "placeId", fields: [.placeID, .name, .phoneNumber] ) .sink { completion in print("Completion \(completion)") } receiveValue: { place in print("Got place \(place.name ?? "")") }
後續步驟
- 查看合併資料庫 GitHub 專案頁面。