Skip to content

Latest commit

 

History

History
45 lines (28 loc) · 1.38 KB

README.md

File metadata and controls

45 lines (28 loc) · 1.38 KB

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