Issue #127 07 Feb 2019
Written by: Bas Broek
When Jesse announced that issue 100 would be the Brief’s final issue, I reached out to him, having helped out with the Brief in the past, to take over the project.
Not only did I really care about this project, but I also felt that it would be a shame to lose this resource for all of you… and myself. I happily took over the project (and still feel very fortunate to continue the effort to this day!) and here we are.
I hope to continue the effort for the foreseeable future! That said, keeping up a newsletter is no easy feat and any help is very much appreciated.
I want to thank all of the readers, sponsors and specifically contributors over the last year. You all rock!
Here is to the next year of the Brief! 🏎
Unfortunately, there is no standard components in iOS to compose drawings, so we are forced to use cumbersome rendering directly on graphics context. Community of iOS developers on Github offers several frameworks to describe graphic components as a scene of primitives. Nowadays, Macaw is the most powerful framework allowing you to create custom components, charts, diagrams and use SVG files. It’s an open source project with 4K+ starts on Github, so take it, use it, and make your life easier.
- SR-9738 [Compiler] Poor error message when calling @dynamicCallable with incorrect parameter types
- SR-9781 [Compiler] Crash on concrete typealias access through existential metatype
- SR-9784 [Compiler] Crash on accessing type alias through protocol-type instance
- SR-9789 [Compiler] Use “pretty” nullability in generated ObjC headers
On Swift Unwrapped, Jesse and JP discuss Key Path Expressions as Functions.
On the Swift Community Podcast, Garric, Chris and myself discuss Scaling A Codeless Open Source Swift Community.
News and community
[..] from now on we will be releasing monthly Swift 4.2.x dot versions for Linux over the next few months. That means you can expect Swift 4.2.3 by the end of February 2019, 4.2.4 by the end of March 2019 and so on.
Apple released the first Xcode 10.2 beta some time ago. The release notes are now available on the website, without having to login to access the PDF anymore!
Commits and pull requests
The proposal is accepted with modifications, specifically:
- The algorithm’s semantic guarantees have been weakened to specify that it will produce a difference to get from the
selfstate to the
otherstate, but not guarantee the shortest such difference. The intent is to allow the standard library to provide a balanced algorithm that provides the shortest difference when possible (e.g., for inputs with fewer differences) but won’t exhibit quadratic behavior for large inputs with many differences.
- The name of the algorithm itself is changed from
- The name of the collection of differences is changed from
Proposals in review
SE-0180 introduced a computed variable and initializer surrounding the concept of an
encodedOffsetfor serialization purposes. Unfortunately, that approach is flawed for its intended purpose and is commonly misused in ways that Swift 5 is more likely to expose. It is too late in the Swift 5.0 release to solve all existing problems, so we propose deprecating
encodedOffsetand introducing a targeted, semantics-preserving alternative.
Unfortunately, SE-0180’s approach of a single notion of
encodedOffsetis flawed. A string can be serialized with a choice of encodings, and the offset is therefore encoding-dependent and requires access to the contents of the string to calculate. A comment in SE-0180’s example source mentioned that
encodedOffsetassumes UTF-16, which happened to be the only encoding used internally by String at the time (for offset purposes).
Furthermore, the majority of uses of
encodedOffsetin the wild are not following SE-0180’s intended purpose and are sensitive to encoding changes.
encodedOffsetis frequently misused under the assumption that all Characters are comprised of a single code unit, which is error-prone and Swift 5 might surface the underlying bugs in more situations. It is also sometimes used for mapping Cocoa string indices, which happens to work in Swift 4 but might not in Swift 5, and Foundation already provides better alternatives.
Swift is hard. Especially if you want it to be.