Watched WWDC 2017 session What's New in Swift
Trying to understand ArraySlice
, watched WWDC 2017 session What’s New in Swift. This didn’t help much to understand ArraySlice
but was useful anyway. Side learnings:
-
private
in declaration works for all extensions in a file!!! There’s no need to usefileprivate
for that! -
it’s possible to compose a class with any number of protocols like in
func f(_ controls: [UIControl & Shakeable]) {}
Working on PR for Gnosis safe realised that the only way to avoid such double conversion of JSON object (in sense of Objective-C) into Codable is to write custom Encoder which accepts not data but such JSON object and encodes it into Codable. After googling (1, 2) realised that the only way to implement it by now is copy-paste JSONEncoder.swift with minor changes. Mike Ash’s Friday Q&A 2017-07-28: A Binary Coder for Swift worth learning before jumping in.