This file contains hidden or 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 Container: View { | |
| init() { | |
| // To remove only extra separators below the list: | |
| UITableView.appearance().tableFooterView = UIView() | |
| // To remove all separators including the actual ones: | |
| UITableView.appearance().separatorStyle = .none | |
| } | |
This file contains hidden or 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 DropDown: View { | |
| @State var expand = false | |
| var body: some View { | |
| VStack(alignment: .leading, spacing: 18, content: { | |
| HStack { | |
| Text("Expand").fontWeight(.heavy).foregroundColor(.white) | |
| Image(systemName: expand ? "chevron.up" : "chevron.down").resizable().frame(width: 13, height: 6).foregroundColor(.white) | |
| } | |
| .onTapGesture { |
This file contains hidden or 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
| let data: Data = ... | |
| let decoder = JSONDecoder() | |
| // This will create a Result<Model, Error> instance, which will contain | |
| // 'success' if its expression succeeded, and 'failure' if it ended | |
| // up throwing an error: | |
| let result = Result { | |
| try decoder.decode(Model.self, from: data) | |
| } |
This file contains hidden or 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
| // Introducing a 'combine' function for applying a value to | |
| // any function or closure: | |
| func combine<A, B>( | |
| _ value: A, | |
| with closure: @escaping (A) -> B | |
| ) -> () -> B { | |
| return { closure(value) } | |
| } | |
| // Example |
NewerOlder