Learn about what is new in Swift 4.
This is a companion discussion topic for the original entry at https://www.raywenderlich.com/582-what-s-new-in-swift-4
Learn about what is new in Swift 4.
It looks like there are some very useful changes, particularly relating to Strings and one sided Ranges.
I’m less sure about key-value coding. In the examples given key-value coding appeared more verbose than directly accessing the properties. In addition, it drives a coach and horses through class encapsulation and the Law of Demeter. Can anyone sell me the advantages of key-value coding?
Hi, when can we see Swift 4 or iOS 11 tutorial book coming out?
I think the main use case is for setting block based key-value-observing. Have you seen the “What’s new in Foundation?” WWDC session yet? [Disclaimer: I have never been a super big fan of key value observing and I haven’t fully thought through the ramifications of the new system. It seems like a more reactive (without the functional) model of programming.]
We are working on them. I would expect them to come out shortly after Swift 4 / Xcode 9 goes GM. There are some parts of it still in the oven as you can see by reading the evolution mailing list.
Still no direct subscripts for strings? I mean, I kind of understand why, but I’m not sure I agree with the logic.
looks like you can replace
var milkSubstring = galaxy[galaxy.startIndex...endIndex]
with
var milkSubstring = galaxy[...endIndex]
@toinewx you most definitely can, I just didn’t want to introduce two new features at the same time. That comes in “One-Sided Ranges” further down the post.
“Still no direct subscripts for strings? I mean, I kind of understand why, but I’m not sure I agree with the logic.”
Bruce’s question is directly referring to the “Elephant in the Room”. Here we are at Swift 4 and there are still no string subscripts.
Judging by the amount of time I have invested in trying to figure out how to write string manipulation functions and looking at the thousands of lines in Stackoverflow dedicated to this topic, developers must be collectively wasting thousands of hours on what should be a trivial issue.
What were you thinking of, Chris Lattner? It’s not rocket science nor for that matter, electric-car science!
This tutorial is more than six months old so questions are no longer supported at the moment for it. We will update it as soon as possible. Thank you! :]