var code: Int { switch self { case .memoryLimit: return -1001 } } public var message: String { switch self { case .memoryLimit: "ϝϞϦͷ੍ݶΛ͑ͨͨΊΞϓϦ͕ऴྃ͠·ͨ͠" } } public var userInfo: [String: Any] { var userInfo = ["message": message] switch self { case let .memoryLimit(count, averageSuspendedMemory, peakMemoryUsage): userInfo["cumulative-count"] = "\(count)" if let averageSuspendedMemory { userInfo["average-suspended-memory"] = "\(averageSuspendedMemory)" } if let peakMemoryUsage { userInfo["peak-memory-usage"] = "\(peakMemoryUsage)" } } return userInfo } }
var code: Int { switch self { case .memoryLimit: return -1001 } } public var message: String { switch self { case .memoryLimit: "ϝϞϦͷ੍ݶΛ͑ͨͨΊΞϓϦ͕ऴྃ͠·ͨ͠" } } public var userInfo: [String: Any] { var userInfo = ["message": message] switch self { case let .memoryLimit(count, averageSuspendedMemory, peakMemoryUsage): userInfo["cumulative-count"] = "\(count)" if let averageSuspendedMemory { userInfo["average-suspended-memory"] = "\(averageSuspendedMemory)" } if let peakMemoryUsage { userInfo["peak-memory-usage"] = "\(peakMemoryUsage)" } } return userInfo } }
var code: Int { switch self { case .memoryLimit: return -1001 } } public var message: String { switch self { case .memoryLimit: "ϝϞϦͷ੍ݶΛ͑ͨͨΊΞϓϦ͕ऴྃ͠·ͨ͠" } } public var userInfo: [String: Any] { var userInfo = ["message": message] switch self { case let .memoryLimit(count, averageSuspendedMemory, peakMemoryUsage): userInfo["cumulative-count"] = "\(count)" if let averageSuspendedMemory { userInfo["average-suspended-memory"] = "\(averageSuspendedMemory)" } if let peakMemoryUsage { userInfo["peak-memory-usage"] = "\(peakMemoryUsage)" } } return userInfo } }