diff --git a/_drafts/2018-04-05-issue-106.md b/_posts/2018-04-05-issue-106.md similarity index 94% rename from _drafts/2018-04-05-issue-106.md rename to _posts/2018-04-05-issue-106.md index c39cebbf..f527e08c 100644 --- a/_drafts/2018-04-05-issue-106.md +++ b/_posts/2018-04-05-issue-106.md @@ -14,7 +14,7 @@ author: gregheo There’s been plenty of news to make developers experience the full range of emotions: [Xcode 9.3](https://developer.apple.com/news/releases/?id=03292018d) with [Swift 4.1](https://swift.org/blog/swift-4-1-released/) made it out of the gate, the WWDC ticket lottery smiled on some and caused gnashing of teeth in others. -Meanwhile, Swift 4.2 and beyond await us. As a reminder, the final merge into the Swift 4.2 branch before a soak period is [coming up in two weeks, on April 20](https://swift.org/blog/4-2-release-process/). +Meanwhile, Swift 4.2 and beyond await us. As a reminder, the final merge into the Swift 4.2 branch before the soak period is [coming up in two weeks, on April 20](https://swift.org/blog/4-2-release-process/). What’s new in the world of Swift? Read on! @@ -43,7 +43,7 @@ In [Episode 52](https://spec.fm/podcasts/swift-unwrapped/129738), JP and Jesse c Languages & Runtime manager [Ted Kremenek](https://twitter.com/tkremenek) shared photos of some [new office decorations over at Swift HQ](https://twitter.com/tkremenek/status/977268865066450944). 🤖 -[Chris Lattner](https://twitter.com/clattner_llvm) announced [Swift for TensorFlow](https://groups.google.com/a/tensorflow.org/forum/#!topic/swift/xtXCEvtDe5Q), bringing first-class compiler and language support for the machine learning framework. Aside from the post, you can also check out [the video announcement](https://www.youtube.com/watch?list=PLQY2H8rRoyvxjVx3zfw4vA4cvlKogyLNN&v=Yze693W4MaU) from Chris and Richard Wei presented at the TensorFlow Dev Summit 2018. +[Chris Lattner](https://twitter.com/clattner_llvm) announced [Swift for TensorFlow](https://groups.google.com/a/tensorflow.org/forum/#!topic/swift/xtXCEvtDe5Q), bringing first-class compiler and language support for the machine learning framework. Aside from the post, you can also [watch the video announcement](https://www.youtube.com/watch?list=PLQY2H8rRoyvxjVx3zfw4vA4cvlKogyLNN&v=Yze693W4MaU) presented at the TensorFlow Dev Summit 2018 by Chris and Richard Wei. [try! Swift San Jose](https://www.tryswift.co/events/2018/sanjose/) was announced, with a focus on Swift Evolution and all the other Swift open source projects. @@ -104,10 +104,24 @@ We already have methods `first(where:)` and `index(where:)`, and this proposal w > This proposal introduces a new `Hasher` type representing the standard library's universal hash function, and it extends the `Hashable` protocol with a new `hash(into:)` requirement that expresses hashing in terms of `Hasher`. [...] Standardizing on a single, high-quality hash function greatly improves the reliability of `Set` and `Dictionary`. + [SE-0207](https://github.com/apple/swift-evolution/blob/master/proposals/0207-containsOnly.md): *Add a `containsOnly` algorithm to `Sequence`* by Ben Cohen is [under review](https://forums.swift.org/t/se-0207-add-a-containsonly-algorithm-to-sequence/11686). > It is common to want to confirm that every element of a sequence equals a value, or matches a certain criteria. Many implementations of this can be found in use on GitHub. This proposal adds such a method to `Sequence`. +Instead of this: + +{% highlight swift %} +// every element is 9 +!nums.contains { $0 != 9 } +{% endhighlight %} + +You'll be able to do this: + +{% highlight swift %} +nums.containsOnly(9) +{% endhighlight %} + [Joe Groff](https://twitter.com/jckarter) [suggested a proposal to add `offset(of:)` to `MemoryLayout`](https://github.com/apple/swift-evolution/pull/818/files?diff=unified).