Overview
The Obsidian iOS SDK helps developers easily integrate Obsidian into their iOS applications. Obsidian is a secure, end-to-end encrypted communication and collaboration platform.
Requirements
- iOS 10.0 or later
- Xcode 11.0 or later
- Swift 5.0 or later
Installation
To integrate the Obsidian iOS SDK into your project, you can use CocoaPods or manually install it.
CocoaPods
- Add the following line to your project’s Podfile:
- Run the command
pod install
. - Open your project’s workspace, usually named
YourProject.xcworkspace
.
“`ruby
pod ‘Obsidian’
“`
Manual Installation
- Download the Obsidian SDK zip file from the Obsidian SDK website.
- Unzip the file and drag the
Obsidian.framework
folder into your Xcode project. - In Xcode, go to your project’s settings, select the target, and go to the “General” tab.
- Scroll down to the “Frameworks, Libraries, and Embedded Content” section.
- Add the
Obsidian.framework
to the list of frameworks and libraries.
Usage
Before using the Obsidian SDK, you need to obtain an API key. You can request an API key from the Obsidian developer portal.
Adding Imports
In the file where you want to use the Obsidian SDK, add the following import statements:
“`swift
import Obsidian
import ObsidianReactive
“`
Configuration
Set up the Obsidian SDK with your API key in your application’s didFinishLaunchingWithOptions
method:
“`swift
Obsidian.shared.configure(apiKey: “YOUR_API_KEY”)
“`
Registering a User
You can register a new user by calling the registerUser
method:
“`swift
Obsidian.shared.registerUser(email: “user@example.com”, password: “password”) { result in
switch result {
case .success(let user):
print(“User registered successfully: \(user.id)”)
case .failure(let error):
print(“Registration failed: \(error)”)
}
}
“`
Logging in
Logging in is done via the login
method:
“`swift
Obsidian.shared.login(email: “user@example.com”, password: “password”) { result in
switch result {
case .success(let user):
print(“User logged in successfully: \(user.id)”)
case .failure(let error):
print(“Login failed: \(error)”)
}
}
“`
Sending a Message
You can send a message to another user by calling the sendMessage
method:
“`swift
Obsidian.shared.sendMessage(to: “recipientUserId”, message: “Hello, World!”) { result in
switch result {
case .success:
print(“Message sent successfully”)
case .failure(let error):
print(“Failed to send message: \(error)”)
}
}
“`
Documentation
For detailed documentation on the Obsidian iOS SDK and its functionalities, refer to the Obsidian iOS SDK documentation.
Support
If you encounter any issues or have any questions, please reach out to our support team at support@example.com.