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
| // Instead of this | |
| Picker(selection: $viewModel.monthViewHideAction) { | |
| ForEach(FilterDecorationHideAction.allCases, id: \.rawValue) { p in | |
| Text(p.localized).tag(p) | |
| } | |
| } label: { | |
| Text("Event text") | |
| } | |
| // I use this |
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
| import 'package:intl/date_symbol_data_local.dart'; | |
| import 'package:intl/intl.dart'; | |
| void main() async { | |
| await initializeDateFormatting(); | |
| final dt = DateTime.now(); | |
| print(DateFormat.yMd('en_UK').format(dt)); | |
| print(DateFormat.yMd('da_DK').format(dt)); | |
| print(DateFormat('dd.MM.yyyy').format(dt)); |
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
| import Foundation | |
| final class Persistent { | |
| static let standard: Persistent = .init() | |
| private var store: UserDefaults = UserDefaults.standard | |
| private lazy var jsonEncoder: JSONEncoder = JSONEncoder() | |
| private lazy var jsonDecoder: JSONDecoder = JSONDecoder() | |
| func reset() { | |
| // ref: https://stackoverflow.com/a/43402290/833197 |