Run ❯
Get your
own
website
❯
Run Code
Ctrl+Alt+R
Change Orientation
Ctrl+Alt+O
Change Theme
Ctrl+Alt+D
Go to Spaces
Ctrl+Alt+P
public struct APIClient { public init() {} public func request() { print("Request sent") } } struct Repository { // internal by default fileprivate var cache: [String: String] = [:] mutating func store(key: String, value: String) { cache[key] = value } private mutating func reset() { cache.removeAll() } mutating func clear() { reset() } } var client = APIClient() client.request() var repo = Repository() repo.store(key: "id", value: "123") print("Cache count:", repo.cache.count) repo.clear() print("Cache count after clear:", repo.cache.count)