Google Maps Platform に間もなく新しい地図のスタイルが導入されます。このアップデートにより、デフォルトのカラーパレットが新しくなるほか、地図のエクスペリエンスとユーザビリティが改善されます。すべての地図のスタイルは、2025 年 3 月に自動的に更新されます。ご利用の詳細およびいち早く使用する方法については、
Google Maps Platform の新しい地図のスタイルをご覧ください。
ライブラリの結合
Combine は
イベント処理演算子を組み合わせて非同期イベントを処理するフレームワークです。
Combine を使用すると、イベント処理コードを一元化することで、コードの読みやすさと保守が容易になります。
GoogleMapsPlatformCombine ライブラリ
Swift ライブラリで
Publishers
サポートされており、
豊富な機能を使用して
インストール
GoogleMapsPlatformCombine ライブラリをご覧ください。
で最新のシステム要件とインストール手順をご確認ください。
サンプル使用量
GoogleMapsPlatformCombine ライブラリには、
GMSMapViewPublisher
クラス
これには、地図によって出力されたイベントに登録できるパブリッシャー プロパティが含まれています。
次の例では、GMSMapViewPublisher
インスタンスをサブスクライブするように構成します。
カメラの変更イベント:
let publisher = GMSMapViewPublisher(mapView: mapView)
publisher.didChangeCameraPosition.sink { cameraPosition in
print("Camera position at \(cameraPosition.target)")
}
次のステップ
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2024-09-13 UTC。
[null,null,["最終更新日 2024-09-13 UTC。"],[[["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."]]],[]]