Google 地圖平台即將推出新版地圖樣式。新版地圖樣式內建全新的預設調色盤,並且提升地圖體驗、改善服務的可用性。所有地圖樣式都將於 2025 年 3 月自動更新。請參閱「
Google 地圖平台新版地圖樣式」一文,進一步瞭解適用範圍及如何提早啟用。
合併程式庫
合併是
這個架構可用於結合事件處理運算子來處理非同步事件。
合併功能可讓您集中處理事件處理程式碼,以便讀取及維護程式碼。
GoogleMapsPlatformCombine 程式庫
這個 Swift 程式庫會傳回
Publishers
敬上
Maps SDK for iOS 和 Places SDK for iOS 版本,這樣您就能
更豐富的「合併」功能組合
安裝
查看
GoogleMapsPlatformCombine 程式庫
說明文件,瞭解最新系統需求和安裝操作說明。
使用範例
GoogleMapsPlatformCombine 程式庫包含
GMSMapViewPublisher
類別
包含發布商屬性,可讓您訂閱地圖所引發的事件。
以下範例會設定要訂閱的 GMSMapViewPublisher
例項
攝影機變更事件:
let publisher = GMSMapViewPublisher(mapView: mapView)
publisher.didChangeCameraPosition.sink { cameraPosition in
print("Camera position at \(cameraPosition.target)")
}
後續步驟
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2024-09-13 (世界標準時間)。
[null,null,["上次更新時間:2024-09-13 (世界標準時間)。"],[[["GoogleMapsPlatformCombine is a Swift library that integrates the Maps SDK for iOS and Places SDK for iOS with Apple's Combine framework."],["This library provides Publishers for various SDK functionalities, allowing developers to leverage Combine's features for asynchronous event handling."],["By using GoogleMapsPlatformCombine, developers can simplify their code and centralize event-processing logic for Google Maps and Places SDKs within their applications."],["A practical example demonstrates subscribing to camera change events on a `GMSMapView` using the `GMSMapViewPublisher` and Combine's `sink` operator."]]],[]]