Skip to content

Commit 8fd5d4d

Browse files
committed
made access public
1 parent 2f8fea6 commit 8fd5d4d

File tree

4 files changed

+22
-22
lines changed

4 files changed

+22
-22
lines changed

Sources/MultiUser/Model/User.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import Foundation
99

10-
struct User : Codable {
10+
public struct User : Codable {
1111
private var uuid:UUID
1212

1313
var username: String?
@@ -19,11 +19,11 @@ struct User : Codable {
1919
var icon: Data?
2020
var data: [Data]?
2121

22-
init() {
22+
public init() {
2323
self.uuid = UUID()
2424
}
2525

26-
init(from decoder: Decoder) throws {
26+
public init(from decoder: Decoder) throws {
2727
let values = try decoder.container(keyedBy: CodingKeys.self)
2828
self.uuid = try values.decode(UUID.self, forKey: .uuid)
2929
self.username = try values.decode(String.self, forKey: .username)
@@ -36,7 +36,7 @@ struct User : Codable {
3636
self.data = try values.decode([Data].self, forKey: .data)
3737
}
3838

39-
func encode(to encoder: Encoder) throws {
39+
public func encode(to encoder: Encoder) throws {
4040
var container = encoder.container(keyedBy: CodingKeys.self)
4141
try container.encode(self.uuid, forKey: .uuid)
4242
try container.encode(self.username, forKey: .username)
@@ -49,7 +49,7 @@ struct User : Codable {
4949
try container.encode(self.data, forKey: .data)
5050
}
5151

52-
var id: UUID {
52+
public var id: UUID {
5353
get {
5454
return self.uuid
5555
}

Sources/MultiUser/Model/UserIndex.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@
77

88
import Foundation
99

10-
struct UserIndex : Codable {
10+
public struct UserIndex : Codable {
1111
var currentUserUUID: UUID?
1212

13-
init() {
13+
public init() {
1414
}
1515

16-
init(from decoder: Decoder) throws {
16+
public init(from decoder: Decoder) throws {
1717
let values = try decoder.container(keyedBy: CodingKeys.self)
1818
self.currentUserUUID = try values.decode(UUID.self, forKey: .currentUserUUID)
1919
}
2020

21-
func encode(to encoder: Encoder) throws {
21+
public func encode(to encoder: Encoder) throws {
2222
var container = encoder.container(keyedBy: CodingKeys.self)
2323
try container.encode(self.currentUserUUID, forKey: .currentUserUUID)
2424
}

Sources/MultiUser/PropertyListUserRepository.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77

88
import Foundation
99

10-
class PropertyListUserRepository : UserRepositoryProtocol {
10+
public class PropertyListUserRepository : UserRepositoryProtocol {
1111

12-
init() {
12+
public init() {
1313
do
1414
{
1515
try FileManager.default.createDirectory(atPath: usersDirectory.path, withIntermediateDirectories: true, attributes: nil)
@@ -20,7 +20,7 @@ class PropertyListUserRepository : UserRepositoryProtocol {
2020
}
2121
}
2222

23-
func save(user: User) {
23+
public func save(user: User) {
2424
let encoder = PropertyListEncoder()
2525
encoder.outputFormat = .xml
2626
do {
@@ -34,7 +34,7 @@ class PropertyListUserRepository : UserRepositoryProtocol {
3434
}
3535
}
3636

37-
func delete(user: User) {
37+
public func delete(user: User) {
3838
do
3939
{
4040
guard let url = self.getURL(user: user) else {
@@ -48,7 +48,7 @@ class PropertyListUserRepository : UserRepositoryProtocol {
4848
}
4949
}
5050

51-
var all: [User] {
51+
public var all: [User] {
5252
var users = [User]()
5353
for userURL in self.userURLs {
5454
guard let user = self.read(url: userURL) else {
@@ -59,7 +59,7 @@ class PropertyListUserRepository : UserRepositoryProtocol {
5959
return users
6060
}
6161

62-
var current: User? {
62+
public var current: User? {
6363
get {
6464
guard let currentUserUUID = self.userIndex?.currentUserUUID else {
6565
return nil

Sources/MultiUser/UserService.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import Foundation
99

10-
class UserService : UserServiceProtocol {
10+
public class UserService : UserServiceProtocol {
1111

1212
private var userRepository :UserRepositoryProtocol
1313

@@ -19,32 +19,32 @@ class UserService : UserServiceProtocol {
1919
self.userRepository = PropertyListUserRepository()
2020
}
2121

22-
func create() -> User {
22+
public func create() -> User {
2323
let user = User()
2424
self.userRepository.save(user: user)
2525
return user
2626
}
2727

28-
func save(user: User) {
28+
public func save(user: User) {
2929
self.userRepository.save(user: user)
3030
}
3131

32-
func delete(user: User) {
32+
public func delete(user: User) {
3333
if(current?.id == user.id) {
3434
current = nil
3535
}
3636
self.userRepository.delete(user: user)
3737
}
3838

39-
var all: [User] {
39+
public var all: [User] {
4040
return self.userRepository.all
4141
}
4242

43-
var hasUsers: Bool {
43+
public var hasUsers: Bool {
4444
return self.all.count > 0
4545
}
4646

47-
var current: User? {
47+
public var current: User? {
4848
get {
4949
return self.userRepository.current
5050
}

0 commit comments

Comments
 (0)