Skip to content

Commit c5335bf

Browse files
committed
Identifiable conformance of NKShareAccounts.
This enables the presentation of NKShareAccounts in a SwiftUI list. Signed-off-by: Iva Horn <iva.horn@icloud.com>
1 parent d1b2adb commit c5335bf

1 file changed

Lines changed: 29 additions & 1 deletion

File tree

Sources/NextcloudKit/NKShareAccounts.swift

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,33 @@ import Foundation
66
#if os(iOS)
77
import UIKit
88

9+
///
10+
/// Facility to read and write partial account information shared among apps of the same security group.
11+
/// This is the foundation for the quick account selection feature on login.
12+
///
913
public class NKShareAccounts: NSObject {
10-
public class DataAccounts: NSObject {
14+
///
15+
/// Data transfer object to pass between ``NKShareAccounts`` and calling code.
16+
///
17+
public class DataAccounts: NSObject, Identifiable {
18+
///
19+
/// The server address of the account.
20+
///
1121
public var url: String
22+
23+
///
24+
/// The login name for the account.
25+
///
1226
public var user: String
27+
28+
///
29+
/// The display name of the account.
30+
///
1331
public var name: String?
32+
33+
///
34+
/// The ccount profile picture.
35+
///
1436
public var image: UIImage?
1537

1638
public init(withUrl url: String, user: String, name: String? = nil, image: UIImage? = nil) {
@@ -34,6 +56,9 @@ public class NKShareAccounts: NSObject {
3456
internal let fileName: String = "accounts.json"
3557
internal let directoryAccounts: String = "Library/Application Support/NextcloudAccounts"
3658

59+
///
60+
/// Store shared account information in the app group container.
61+
///
3762
/// - Parameters:
3863
/// - directory: the group directory of share the accounts (group.com.nextcloud.apps), use the func containerURL(forSecurityApplicationGroupIdentifier groupIdentifier: String) -> URL? // Available for OS X in 10.8.3.
3964
/// - app: the name of app
@@ -81,6 +106,9 @@ public class NKShareAccounts: NSObject {
81106
return nil
82107
}
83108

109+
///
110+
/// Read the shared account information from the app group container.
111+
///
84112
/// - Parameters:
85113
/// - directory: the group directory of share the accounts (group.com.nextcloud.apps), use the func containerURL(forSecurityApplicationGroupIdentifier groupIdentifier: String) -> URL? // Available for OS X in 10.8.3.
86114
/// - application: the UIApplication used for verify if the app(s) is still installed

0 commit comments

Comments
 (0)