Introduction
Welcome to the Pixnet iOS SDK documentation. This SDK allows developers to easily integrate Pixnet’s features into their iOS applications. This guide will help you understand the various components of the Pixnet iOS SDK and how to use them in your projects.
Getting Started
Follow the steps below to get started with the Pixnet iOS SDK:
1. Installation
To begin, you need to install the Pixnet iOS SDK. Follow the steps below:
- Open your project in Xcode.
- Navigate to the File menu and click on Swift packages > Add Package Dependency.
- In the URL field, enter
https://github.com/pixnet/pixnet-ios-sdk.git
. - Click Next and select the version or branch you want to use.
- Click Finish to complete the installation.
2. Initialization
Once you have installed the Pixnet iOS SDK, you need to initialize it in your application. Follow the steps below:
- In your AppDelegate.swift file, import the Pixnet module.
- In the
application(_:didFinishLaunchingWithOptions:)
method, add the following code to initialize the SDK:
// Import Pixnet module
import Pixnet
// Initialize Pixnet SDK
PixnetSDK.initialize(clientID: "YOUR_CLIENT_ID", clientSecret: "YOUR_CLIENT_SECRET") { (success, error) in
if success {
print("SDK initialized successfully.")
} else {
print("SDK initialization failed with error: \(error?.localizedDescription ?? "")")
}
}
Usage
The Pixnet iOS SDK provides various features that you can use in your iOS application. Here are some of the most commonly used features:
1. User Authentication
To authenticate a user with Pixnet, use the following steps:
- Call the
PixnetSDK.login(withViewController:completion:)
method to initiate the login process. Pass the current view controller and a completion handler. - In the completion handler, check the
success
parameter to determine if the login was successful. If successful, you can access the user’s access token viaPixnetSDK.shared.accessToken
.
2. Uploading Photos
If you want to allow users to upload photos to Pixnet, you can follow these steps:
- Use the
PixnetSDK.uploadPhoto(_:completion:)
method to initiate the photo upload process. Pass the photo data and a completion handler. - In the completion handler, check the
success
parameter to determine if the upload was successful. You can also access the uploaded photo’s URL viaphoto.url
.
Additional Resources
For more information about the Pixnet iOS SDK, refer to the following resources:
1. Official Documentation
Visit the official documentation for a comprehensive guide on using the Pixnet iOS SDK: Pixnet iOS SDK Documentation
2. GitHub Repository
Access the Pixnet iOS SDK GitHub repository for the latest updates, examples, and issues: Pixnet iOS SDK GitHub Repository