Skip to content

Commit

Permalink
Merge pull request stadiamaps#34 from Rallista/feat/example-ios
Browse files Browse the repository at this point in the history
Feat/example ios
  • Loading branch information
ianthetechie authored Jan 22, 2024
2 parents a69c6a3 + dd39e4f commit dce207f
Show file tree
Hide file tree
Showing 27 changed files with 1,229 additions and 115 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,7 @@ xcuserdata/
.DS_Store

# Android (cargo-ndk outputs; they end up in the Android source tree)
*.so
*.so

# Example App
API-Keys.plist
19 changes: 14 additions & 5 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -1,21 +1,30 @@
{
"pins" : [
{
"identity" : "maplibre-swiftui-dsl-playground",
"identity" : "maplibre-gl-native-distribution",
"kind" : "remoteSourceControl",
"location" : "https://github.com/stadiamaps/maplibre-swiftui-dsl-playground",
"location" : "https://github.com/maplibre/maplibre-gl-native-distribution.git",
"state" : {
"revision" : "3b88d990bc39ed5347852a536c0efd942a07fc97",
"version" : "6.0.0-pre9599200f2529de44ba62d4662cddb445dc19397d"
}
},
{
"identity" : "maplibre-swift-macros",
"kind" : "remoteSourceControl",
"location" : "https://github.com/stadiamaps/maplibre-swift-macros.git",
"state" : {
"branch" : "main",
"revision" : "6199f3f502ad926653a9d5d1e12206f52f0aa55e"
"revision" : "b8deecb8adc3b911de311ead5a13b98fbf2d7824"
}
},
{
"identity" : "swift-snapshot-testing",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-snapshot-testing",
"state" : {
"revision" : "59b663f68e69f27a87b45de48cb63264b8194605",
"version" : "1.15.1"
"revision" : "8e68404f641300bfd0e37d478683bb275926760c",
"version" : "1.15.2"
}
},
{
Expand Down
12 changes: 9 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
import PackageDescription

let binaryTarget: Target
let maplibreSwiftUIDSLPackage: Package.Dependency
// TODO: Define this via an env variable that doesn't need to be checked in?
let useLocalFramework = false
let useLocalMapLibreSwiftUIDSL = false

if useLocalFramework {
binaryTarget = .binaryTarget(
Expand All @@ -24,6 +26,11 @@ if useLocalFramework {
)
}

if useLocalMapLibreSwiftUIDSL {
maplibreSwiftUIDSLPackage = .package(path: "../maplibre-swiftui-dsl-playground")
} else {
maplibreSwiftUIDSLPackage = .package(url: "https://github.com/stadiamaps/maplibre-swiftui-dsl-playground", branch: "main")
}

let package = Package(
name: "FerrostarCore",
Expand All @@ -42,11 +49,11 @@ let package = Package(
),
],
dependencies: [
.package(url: "https://github.com/stadiamaps/maplibre-swiftui-dsl-playground", branch: "main"),
maplibreSwiftUIDSLPackage,
.package(
url: "https://github.com/pointfreeco/swift-snapshot-testing",
from: "1.15.0"
),
),
],
targets: [
binaryTarget,
Expand All @@ -59,7 +66,6 @@ let package = Package(
name: "FerrostarMapLibreUI",
dependencies: [
.target(name: "FerrostarCore"),
.product(name: "MapLibre", package: "maplibre-swiftui-dsl-playground"),
.product(name: "MapLibreSwiftDSL", package: "maplibre-swiftui-dsl-playground"),
.product(name: "MapLibreSwiftUI", package: "maplibre-swiftui-dsl-playground"),
],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"colors" : [
{
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"images" : [
{
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
6 changes: 6 additions & 0 deletions apple/DemoApp/Demo/Assets.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
22 changes: 22 additions & 0 deletions apple/DemoApp/Demo/ConfigurationView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//
// ConfigurationView.swift
// Ferrostar Demo
//
// Created by Jacob Fielding on 12/6/23.
//

import SwiftUI

struct ConfigurationView: View {

var body: some View {
VStack(spacing: 15) {
Text("TODO basic config for demo")
}
.navigationTitle("Config")
}
}

#Preview {
ConfigurationView()
}
17 changes: 17 additions & 0 deletions apple/DemoApp/Demo/DemoApp.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// DemoApp.swift
// Ferrostar Demo
//
// Created by Ian Wagner on 2023-10-09.
//

import SwiftUI

@main
struct DemoApp: App {
var body: some Scene {
WindowGroup {
NavigationView()
}
}
}
25 changes: 25 additions & 0 deletions apple/DemoApp/Demo/Helpers/APIKeys.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//
// APIKeys.swift
// Ferrostar Demo
//
// Created by Jacob Fielding on 12/17/23.
//

import Foundation

class APIKeys {

static let shared = APIKeys()

let stadiaMapsAPIKey: String

init() {
guard let path = Bundle.main.path(forResource: "API-Keys", ofType: "plist"),
let data = FileManager.default.contents(atPath: path),
let dict = try! PropertyListSerialization.propertyList(from: data, options: .mutableContainersAndLeaves, format: nil) as? [String: Any] else {
fatalError("API-Keys.plist not found or invalid.")
}

stadiaMapsAPIKey = (dict["STADIAMAPS_API_KEY"] as! String)
}
}
27 changes: 27 additions & 0 deletions apple/DemoApp/Demo/Helpers/MockLocationData.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//
// MockLocationData.swift
// Ferrostar Demo
//
// Created by Jacob Fielding on 12/17/23.
//

import Foundation
import CoreLocation

struct LocationIdentifier : Identifiable, Equatable, Hashable {
static func == (lhs: LocationIdentifier, rhs: LocationIdentifier) -> Bool {
lhs.id == rhs.id
}

func hash(into hasher: inout Hasher) {
hasher.combine(id)
}

let id = UUID()
let name: String
let coordinate: CLLocationCoordinate2D
}

let locations = [
LocationIdentifier(name: "Cupertino HS", coordinate: CLLocationCoordinate2D(latitude: 37.31910, longitude: -122.01018)),
]
Loading

0 comments on commit dce207f

Please sign in to comment.