Install SkyPath iOS SDK
Overview
SkyPath iOS SDK enables your iOS applications to interact with SkyPath using either the Swift or Objective-C programming languages. This page details how to install SkyPath in your project and get started.
Prerequisites
Before getting started, ensure your development environment meets the following prerequisites:
- Xcode version 15.3 or higher.
- A target of iOS 14.0 or higher.
Installation
The SkyPath iOS SDK is provided as a pre-built .xcframework written in Swift.
- Swift Package Manager (Recommended)
- CocoaPods
- Manually
The Swift Package Manager is a tool for automating the distribution of Swift code. It’s integrated with the Swift build system to automate the process of downloading, compiling, and linking dependencies.
-
Add Package Dependency
In Xcode, select
File
>Add Packages...
-
Specify the Repository
Copy and paste the following into the search/input box.
https://github.com/Yamasee/skypath-ios-sdk
-
Specify Options
In the options for the
skypath-ios-sdk package
, we recommend setting theDependency Rule
toUp to Next Major Version
, and enter the current SkyPath iOS SDK version. Then, clickAdd Package
. -
Choose Package Products
Select
SkyPathSDK
, then clickAdd Package
.
Make sure SkyPathSDK
is added in "Target Dependencies" and "Link Binary With Libraries" as "Required" under "Build Phases" and in "Frameworks, Libraries, and Embedded Content" under "General".
CocoaPods manages library dependencies for your Xcode projects.
-
Update the CocoaPods repositories
On the command line, run
pod repo update
to ensure CocoaPods can access the latest available SkyPath versions. -
Initialize CocoaPods for Your Project
If you do not already have a Podfile for your project, run
pod init
in the root directory of your project to create a Podfile for your project. A Podfile allows you to specify project dependencies to CocoaPods. -
Add SkyPath as a Dependency in Your Podfile
platform :ios, '14.0'
target 'Project' do
use_frameworks!
pod 'SkyPath'
end -
Install the Dependencies
From the command line, run
pod install
to fetch the dependencies. -
Use the CocoaPods-Generated .xcworkspace File
CocoaPods generates an
.xcworkspace
file for you. This file has all of the dependencies configured. From now on, open this file -- not the.xcodeproj
file -- to work on your project.
The known issue is that there could be a compilation error due to duplicated symbols due to -ObjC
flag in the project build settings.
The workaround is to remove -ObjC
flag by adding this in the end of your Podfile
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
xcconfig_path = config.base_configuration_reference.real_path
xcconfig = File.read(xcconfig_path)
new_xcconfig = xcconfig.sub('OTHER_LDFLAGS = $(inherited) -ObjC', 'OTHER_LDFLAGS = $(inherited)')
File.open(xcconfig_path, "w") { |file| file << new_xcconfig }
end
end
end
However, it could not be suitable if other dependencies require a -ObjC
flag. If so, consider using Swift Package Manager which is recommended way.
Add the SkyPath SDK manually.
-
Download and Extract the Framework
Download the latest release of SkyPath and extract the zip.
-
Copy Framework Into Your Project
Drag
SkyPathSDK.xcframework
to the File Navigator of your Xcode project. Select the Copy items if needed checkbox and press Finish. -
Link Binaries
Select your project in the Xcode File Navigator. Select your app's target and go to the
General
tab. UnderFrameworks, Libraries, and Embedded Content
tapAdd items
, and choose aSkyPathSDK.xcframework
file. Make sure the added frameworkEmbed
value is set toEmbed & Sign
. -
Add the GEOSwift library to the project of the version specified in the dependencies of
Package.swift
. It is used by the SDK for geo operations. In the project target's "General" tab, in the "Frameworks, Libraries, and Embedded Content" setGEOSwift
asEmbed & Sign
.
Import SkyPath
Add the following line at the top of your source files to use SkyPath:
import SkyPathSDK
Background Mode
Location will be used while the app is in the background to keep track of and alert to turbulence.
-
Add Location Updates Background Mode
Select your project in the Xcode File Navigator. Select your app's target and go to the
Signing & Capabilities
tab. PressAdd Capability
and chooseBackground Modes
. UnderBackground Modes
now selectLocation Updates
. -
Open
Info.plist
file of the project and addPrivacy - Location When In Use Usage Description
<key>NSLocationWhenInUseUsageDescription</key>
<string>Location will be used to accurately report and get notified on turbulence ahead</string>
App Download File Size
SkyPathSDK adds around 10 MB to your app's download size.
The releases we distribute are significantly larger because they include support for the iOS simulator which is stripped by the App Store automatically when apps are downloaded.