From 9043174a3b8f34830c7dd7ea9259a5e32798350c Mon Sep 17 00:00:00 2001 From: Marc Prud'hommeaux Date: Tue, 31 Mar 2026 10:19:18 -0400 Subject: [PATCH] Add Google Maps playground --- Package.swift | 2 ++ Sources/Showcase/MapPlayground.swift | 52 ++++++++++++++++++++++++++-- Sources/Showcase/Skip/skip.yml | 2 +- 3 files changed, 53 insertions(+), 3 deletions(-) diff --git a/Package.swift b/Package.swift index bc4fc7c..5372873 100644 --- a/Package.swift +++ b/Package.swift @@ -16,6 +16,7 @@ let package = Package( .package(url: "https://source.skip.tools/skip-sql.git", "0.14.0"..<"2.0.0"), .package(url: "https://source.skip.tools/skip-web.git", "0.8.3"..<"2.0.0"), .package(url: "https://source.skip.tools/skip-device.git", "0.4.2"..<"2.0.0"), + .package(url: "https://source.skip.tools/skip-gmaps.git", branch: "main"), .package(url: "https://source.skip.tools/skip-motion.git", "0.7.2"..<"2.0.0"), .package(url: "https://source.skip.tools/skip-keychain.git", "0.3.2"..<"2.0.0"), .package(url: "https://source.skip.tools/skip-marketplace.git", "0.2.1"..<"2.0.0"), @@ -30,6 +31,7 @@ let package = Package( .product(name: "SkipSQL", package: "skip-sql"), .product(name: "SkipWeb", package: "skip-web"), .product(name: "SkipDevice", package: "skip-device"), + .product(name: "SkipGMaps", package: "skip-gmaps"), .product(name: "SkipMotion", package: "skip-motion"), .product(name: "SkipKeychain", package: "skip-keychain"), .product(name: "SkipMarketplace", package: "skip-marketplace"), diff --git a/Sources/Showcase/MapPlayground.swift b/Sources/Showcase/MapPlayground.swift index 32555a3..53196a2 100644 --- a/Sources/Showcase/MapPlayground.swift +++ b/Sources/Showcase/MapPlayground.swift @@ -1,5 +1,6 @@ // Copyright 2023–2025 Skip import SwiftUI +import SkipGMaps #if !SKIP import MapKit #else @@ -9,13 +10,60 @@ import com.google.android.gms.maps.model.CameraPosition import com.google.android.gms.maps.model.LatLng #endif +enum MapPlaygroundType: String, CaseIterable { + case platform + case google + + var title: String { + switch self { + case .platform: + return "Platform Map" + case .google: + return "Google Maps" + } + } +} + struct MapPlayground: View { + + var body: some View { + List(MapPlaygroundType.allCases, id: \.self) { type in + NavigationLink(type.title, value: type) + } + .toolbar { + PlaygroundSourceLink(file: "MapPlayground.swift") + } + .navigationDestination(for: MapPlaygroundType.self) { + switch $0 { + case .platform: + PlatformMapPlayground() + .navigationTitle($0.title) + case .google: + GMapsPlayground() + .navigationTitle($0.title) + } + } + } +} + +struct GMapsPlayground: View { + init() { + GoogleMapsConfiguration.provideAPIKey("AIzaSyBdt_bhz4zi6WAUelkVkEnxMs9pkbEKXKM") + } + + var body: some View { + GoogleMapView() + } +} + + +struct PlatformMapPlayground: View { var body: some View { - MapView(latitude: 48.8566, longitude: 2.3522) + SimpleMapView(latitude: 48.8566, longitude: 2.3522) } } -struct MapView : View { +struct SimpleMapView : View { let latitude: Double let longitude: Double diff --git a/Sources/Showcase/Skip/skip.yml b/Sources/Showcase/Skip/skip.yml index 52a01b4..23fcb2a 100644 --- a/Sources/Showcase/Skip/skip.yml +++ b/Sources/Showcase/Skip/skip.yml @@ -7,4 +7,4 @@ build: - block: 'dependencies' contents: # dependency used by MapPlayground for custom compose integration - - 'implementation("com.google.maps.android:maps-compose:6.4.1")' + #- 'implementation("com.google.maps.android:maps-compose:6.4.1")'