Setup and initialization
A basic understanding of Swift and XCode is needed to follow this tutorial.
You need XCode. Version >= 3.x installed on your machine.
Set up a dataBridges account and app
Before we jump right into setting up an application with dataBridges, you’ll need to create a dataBridges account and app, if you don’t already have one:
-
Sign up for a dataBridges account.
-
Create a new app by selecting Apps and clicking Create New button.
-
You can retrieve your app credentials from the App Keys tab.
Lets create a project in XCode
Create a project in XCode by choosing the App template from the iOS > Application section. Give the project a name and check the Include Tests checkbox at the bottom. Tell XCode where you would like to store the project on your machine and hit the Create button.
To add databridges_sio_swift_client
package dependency to your Xcode project, select File > Swift Packages > Add Package Dependency... and enter repository URL https://github.com/databridges-io/lib.ios.sio.client.git
.
When you enter the package dependency’s URL, choose Version package requirements, select the latest version. Xcode resolves and fetches the package dependency. Select the package’s products that you need, and add them to targets in your project.
In Xcode Project navigator, the Swift Package Dependencies section shows the newly added databridges_sio_swift_client
package dependency. Click the disclosure triangle to view the contents of the package as it exists locally on your Mac.
Create a Package structure using the command "swift package init --type executable".
Open the Package as XCode proeject.
Edit Package.swift
in XCode and add below lines in let package = Package(
section add below lines
platforms: [.macOS("10.15")],
dependencies: [
.package(name: "databridges_sio_swift_client", url: "https://github.com/databridges-io/lib.ios.sio.client.git" , from: "2.0.2")
],
targets[.target(
add below code to link depencencies to your project. Below is the sample Package.swift file after adding dataBridges dependencies. import PackageDescription
let package = Package(
name: "connections",
platforms: [.macOS("10.15")],
dependencies: [
.package(name: "databridges_sio_swift_client", url: "https://github.com/databridges-io/lib.ios.sio.client.git" , from: "2.0.2")
],
targets: [
.target(
name: "connections",
dependencies: ["databridges_sio_swift_client"]),
]
)