Created
August 4, 2022 20:00
-
-
Save hmlongco/6eb0408b4ea580f06556010a32a09755 to your computer and use it in GitHub Desktop.
WrappedCodable.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct ToDoStore: Codable { | |
let userId: Int | |
let id: Int | |
var title: String | |
var completed: Bool | |
} | |
struct ToDo { | |
private var toDo: ToDoStore | |
public init(toDo: ToDoStore) { | |
self.toDo = toDo | |
} | |
var id: Int { toDo.id } | |
var userId: Int { toDo.userId } | |
var title: String { toDo.title } | |
var isCompleted: Bool { | |
get { toDo.completed } | |
mutating set { toDo.completed = newValue } | |
} | |
var isSelected: Bool = false | |
var isEnabled: Bool = false | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment