From 4a240191d9de224ce5c4558ad34c0a47eb25f2f4 Mon Sep 17 00:00:00 2001 From: Jacob Fielding Date: Tue, 12 Mar 2024 21:53:00 -0700 Subject: [PATCH] feat: swift package setup and OSRM models --- .gitignore | 5 ++++- .../xcode/package.xcworkspace/contents.xcworkspacedata | 7 +++++++ Package.swift | 6 +++++- {Sources => apple/Sources}/OSRM/Models/Annotation.swift | 0 .../Sources}/OSRM/Models/AnnotationMetadata.swift | 0 {Sources => apple/Sources}/OSRM/Models/ApiResponse.swift | 0 {Sources => apple/Sources}/OSRM/Models/Intersection.swift | 0 {Sources => apple/Sources}/OSRM/Models/Lane.swift | 0 .../Sources}/OSRM/Models/NearestResponse.swift | 0 .../Sources}/OSRM/Models/NearestWaypoint.swift | 0 {Sources => apple/Sources}/OSRM/Models/Route.swift | 0 {Sources => apple/Sources}/OSRM/Models/RouteLeg.swift | 0 .../Sources}/OSRM/Models/RouteResponse.swift | 0 {Sources => apple/Sources}/OSRM/Models/RouteStep.swift | 0 {Sources => apple/Sources}/OSRM/Models/StepManeuver.swift | 0 .../Sources}/OSRM/Models/TableResponse.swift | 0 {Sources => apple/Sources}/OSRM/Models/TripResponse.swift | 0 {Sources => apple/Sources}/OSRM/Models/TripWaypoint.swift | 0 {Sources => apple/Sources}/OSRM/Models/Waypoint.swift | 0 generate_models.sh | 8 ++++---- 20 files changed, 20 insertions(+), 6 deletions(-) create mode 100644 .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata rename {Sources => apple/Sources}/OSRM/Models/Annotation.swift (100%) rename {Sources => apple/Sources}/OSRM/Models/AnnotationMetadata.swift (100%) rename {Sources => apple/Sources}/OSRM/Models/ApiResponse.swift (100%) rename {Sources => apple/Sources}/OSRM/Models/Intersection.swift (100%) rename {Sources => apple/Sources}/OSRM/Models/Lane.swift (100%) rename {Sources => apple/Sources}/OSRM/Models/NearestResponse.swift (100%) rename {Sources => apple/Sources}/OSRM/Models/NearestWaypoint.swift (100%) rename {Sources => apple/Sources}/OSRM/Models/Route.swift (100%) rename {Sources => apple/Sources}/OSRM/Models/RouteLeg.swift (100%) rename {Sources => apple/Sources}/OSRM/Models/RouteResponse.swift (100%) rename {Sources => apple/Sources}/OSRM/Models/RouteStep.swift (100%) rename {Sources => apple/Sources}/OSRM/Models/StepManeuver.swift (100%) rename {Sources => apple/Sources}/OSRM/Models/TableResponse.swift (100%) rename {Sources => apple/Sources}/OSRM/Models/TripResponse.swift (100%) rename {Sources => apple/Sources}/OSRM/Models/TripWaypoint.swift (100%) rename {Sources => apple/Sources}/OSRM/Models/Waypoint.swift (100%) diff --git a/.gitignore b/.gitignore index b7f1399..1cbea38 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,4 @@ -.build \ No newline at end of file +.build + +## User settings +xcuserdata/ \ No newline at end of file diff --git a/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Package.swift b/Package.swift index c0ccf9b..4d12651 100644 --- a/Package.swift +++ b/Package.swift @@ -14,12 +14,16 @@ let package = Package( targets: ["OSRM"] ) ], + dependencies: [ + .package(url: "https://github.com/Flight-School/AnyCodable", from: "0.6.1"), + ], targets: [ .target( name: "OSRM", dependencies: [ "AnyCodable" - ] + ], + path: "apple/Sources/OSRM" ) ] ) diff --git a/Sources/OSRM/Models/Annotation.swift b/apple/Sources/OSRM/Models/Annotation.swift similarity index 100% rename from Sources/OSRM/Models/Annotation.swift rename to apple/Sources/OSRM/Models/Annotation.swift diff --git a/Sources/OSRM/Models/AnnotationMetadata.swift b/apple/Sources/OSRM/Models/AnnotationMetadata.swift similarity index 100% rename from Sources/OSRM/Models/AnnotationMetadata.swift rename to apple/Sources/OSRM/Models/AnnotationMetadata.swift diff --git a/Sources/OSRM/Models/ApiResponse.swift b/apple/Sources/OSRM/Models/ApiResponse.swift similarity index 100% rename from Sources/OSRM/Models/ApiResponse.swift rename to apple/Sources/OSRM/Models/ApiResponse.swift diff --git a/Sources/OSRM/Models/Intersection.swift b/apple/Sources/OSRM/Models/Intersection.swift similarity index 100% rename from Sources/OSRM/Models/Intersection.swift rename to apple/Sources/OSRM/Models/Intersection.swift diff --git a/Sources/OSRM/Models/Lane.swift b/apple/Sources/OSRM/Models/Lane.swift similarity index 100% rename from Sources/OSRM/Models/Lane.swift rename to apple/Sources/OSRM/Models/Lane.swift diff --git a/Sources/OSRM/Models/NearestResponse.swift b/apple/Sources/OSRM/Models/NearestResponse.swift similarity index 100% rename from Sources/OSRM/Models/NearestResponse.swift rename to apple/Sources/OSRM/Models/NearestResponse.swift diff --git a/Sources/OSRM/Models/NearestWaypoint.swift b/apple/Sources/OSRM/Models/NearestWaypoint.swift similarity index 100% rename from Sources/OSRM/Models/NearestWaypoint.swift rename to apple/Sources/OSRM/Models/NearestWaypoint.swift diff --git a/Sources/OSRM/Models/Route.swift b/apple/Sources/OSRM/Models/Route.swift similarity index 100% rename from Sources/OSRM/Models/Route.swift rename to apple/Sources/OSRM/Models/Route.swift diff --git a/Sources/OSRM/Models/RouteLeg.swift b/apple/Sources/OSRM/Models/RouteLeg.swift similarity index 100% rename from Sources/OSRM/Models/RouteLeg.swift rename to apple/Sources/OSRM/Models/RouteLeg.swift diff --git a/Sources/OSRM/Models/RouteResponse.swift b/apple/Sources/OSRM/Models/RouteResponse.swift similarity index 100% rename from Sources/OSRM/Models/RouteResponse.swift rename to apple/Sources/OSRM/Models/RouteResponse.swift diff --git a/Sources/OSRM/Models/RouteStep.swift b/apple/Sources/OSRM/Models/RouteStep.swift similarity index 100% rename from Sources/OSRM/Models/RouteStep.swift rename to apple/Sources/OSRM/Models/RouteStep.swift diff --git a/Sources/OSRM/Models/StepManeuver.swift b/apple/Sources/OSRM/Models/StepManeuver.swift similarity index 100% rename from Sources/OSRM/Models/StepManeuver.swift rename to apple/Sources/OSRM/Models/StepManeuver.swift diff --git a/Sources/OSRM/Models/TableResponse.swift b/apple/Sources/OSRM/Models/TableResponse.swift similarity index 100% rename from Sources/OSRM/Models/TableResponse.swift rename to apple/Sources/OSRM/Models/TableResponse.swift diff --git a/Sources/OSRM/Models/TripResponse.swift b/apple/Sources/OSRM/Models/TripResponse.swift similarity index 100% rename from Sources/OSRM/Models/TripResponse.swift rename to apple/Sources/OSRM/Models/TripResponse.swift diff --git a/Sources/OSRM/Models/TripWaypoint.swift b/apple/Sources/OSRM/Models/TripWaypoint.swift similarity index 100% rename from Sources/OSRM/Models/TripWaypoint.swift rename to apple/Sources/OSRM/Models/TripWaypoint.swift diff --git a/Sources/OSRM/Models/Waypoint.swift b/apple/Sources/OSRM/Models/Waypoint.swift similarity index 100% rename from Sources/OSRM/Models/Waypoint.swift rename to apple/Sources/OSRM/Models/Waypoint.swift diff --git a/generate_models.sh b/generate_models.sh index 3004e1a..b69d467 100755 --- a/generate_models.sh +++ b/generate_models.sh @@ -32,10 +32,10 @@ fi if [ "$language" = "swift" ]; then # Clean the Generated Swift Models if $clean; then - if [ -d "./Sources/OSRM/Models" ]; then - rm -r ./Sources/OSRM/Models + if [ -d "./apple/Sources/OSRM/Models" ]; then + rm -r ./apple/Sources/OSRM/Models fi - mkdir -p ./Sources/OSRM/Models + mkdir -p ./apple/Sources/OSRM/Models fi openapi-generator generate -i ./openapi.yaml -g swift5 --strict-spec=true \ @@ -44,7 +44,7 @@ if [ "$language" = "swift" ]; then swiftformat .build/OpenAPIClient/Classes/OpenAPIsModels - cp .build/OpenAPIClient/Classes/OpenAPIsModels/* ./Sources/OSRM/Models + cp .build/OpenAPIClient/Classes/OpenAPIsModels/* ./apple/Sources/OSRM/Models else echo "Language not supported" exit 1