a native ios client for gitbay

client ios swift

https://gitbay.org

gitbay/Auth/Account.swift

20 lines · 672 bytes

 1import Foundation
 2
 3/// One signed-in identity: an account on an instance. gitbay is
 4/// self-hosted, so the pair is the unit  the same person on two
 5/// instances is two accounts.
 6nonisolated struct Account: Codable, Hashable, Sendable, Identifiable {
 7    let instance: GitbayInstance
 8    let username: String
 9
10    /// Stable across renames of nothing  usernames are the identity on an
11    /// instance, and tokens are keyed by this.
12    var id: String {
13        "\(instance.baseURL.absoluteString)#\(username)"
14    }
15
16    /// "cmc on gitbay.org"
17    var label: String {
18        "\(username) on \(instance.baseURL.host() ?? instance.baseURL.absoluteString)"
19    }
20}