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
class TabBarWidget extends StatefulWidget { | |
@override | |
_TabBarWidgetState createState() => _TabBarWidgetState(); | |
} | |
class _TabBarWidgetState extends State<TabBarWidget> { | |
List<Widget> _widgets = [ | |
DashboardPage(), |
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
import UIKit | |
struct ComplexObject: Decodable { | |
let timestamp: Int | |
let identifier: String | |
} | |
extension ComplexObject { | |
enum CodingKeys: String, CodingKey { | |
case timestamp |
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
// Test | |
let json = """ | |
{ | |
"TjOnekTbvbh7XW7aTgEiyr2pccq1": 1565244404531, | |
"Zu9ujNWUi0fSz3Y8pNFJ8PV4Phk1": "some string value", | |
"AC5cZbp4XyPJfTu4zf9TfRQWRY02": { | |
"timestamp": 1566474347575, | |
"identifier": "Cu9BjNKU407Sz3Y8pNFJ8P64Phk1" | |
} | |
} |
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
init(from decoder: Decoder) throws { | |
// 1 | |
do { | |
let singleValueContainer = try decoder.singleValueContainer() | |
let timestamp = try singleValueContainer.decode(Int.self) | |
self = .number(timestamp) | |
return | |
} catch {} | |
// 2 | |
do { |
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
[ | |
{ | |
"id": "10232765268", | |
"type": "CreateEvent", | |
"payload": { | |
"ref": "greenkeeper/size-limit-2.1.1", | |
"ref_type": "branch", | |
"master_branch": "master", | |
"description": "Standard observable implementation", | |
"pusher_type": "user" |
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
Logger.instance.addHandlers([ | |
OsLogHandler(), | |
CrashlyticsLogHandler() | |
]) |
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
class OsLogHandler: LogHandler { | |
func handle( | |
_ level: LogLevel, | |
_ message: String, | |
extra: Any?, | |
category: LogCategory, | |
file: String, | |
line: Int, | |
column: Int, |
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
extension OSLog { | |
private static var subsystem = Bundle.main.bundleIdentifier! | |
static let general = OSLog(subsystem: subsystem, category: LogCategory.general.rawValue) | |
static let viewCycle = OSLog(subsystem: subsystem, category: LogCategory.viewCycle.rawValue) | |
static let memorymanagementCycle = OSLog(subsystem: subsystem, category: LogCategory.memoryManagement.rawValue) | |
} | |
extension LogLevel { | |
var osLogType: OSLogType { |
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
func logData( | |
_ level: LogLevel, | |
_ message: String = "", | |
extra: Any? = nil, | |
category: LogCategory = .general, | |
file: String = #file, | |
line: Int = #line, | |
column: Int = #column, | |
function: String = #function) { | |
NewerOlder