Skip to content

A lightweight Mastodon Swift framework, made for iOS and macOS.

License

Notifications You must be signed in to change notification settings

lumaa-dev/ProboscisKit

Repository files navigation

ProboscisKit

ProboscisKit is a lightweight Mastodon swift package.

A derivative is used in Bubble

ProboscisKit is fully working, the only missing part is the documentation. Soon to be released...


How to start

To start using ProboscisKit, you will have to import it using Xcode's Swift Package Manager, by going in File > Add Package Dependencies...

Then, you can simply paste the GitHub link into the search bar at the top right of the window, and then click on Copy Dependency.

Once this is done, congrats! You successfully added ProboscisKit to your project.

Recognize an instance

To know if a certain URL is a real Mastodon instance or not, you will need to do the following

func isInstance(_ url: URL) async -> Bool {
    let client: Client = .init(server: url)
            
    do {
        let instance: Instance = try await client.get(endpoint: Instances.instance)
        return true // If the URL wasn't a Mastodon instance, it would throw an error
    } catch {
        print("\(instanceUrl) Error: \(error)") // It's always good to keep a error log here
        return false
    }
}

Credits

About

A lightweight Mastodon Swift framework, made for iOS and macOS.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages