
What's new in Swift 3.1 - ihsw
https://www.hackingwithswift.com/swift3-1
======
chris_7
Great language-level features (especially the concrete extensions, finally),
but I'm most interested in whether the compiler still crashes, whether it can
correctly report error messages in code using type inference and closures, and
whether incremental compilation works properly.

~~~
rudedogg
Yeah I agree. I've been using Swift for about 2 years, and my major issue is
the tooling (Xcode, CocoaPods, etc.).

I've been trying plugins for every editor I like (emacs, sublime text, VS
Code), and all the code completion sucks. I've researched it a bit, and it all
appears to be issues with SourceKit itself. I think Swift would do much better
on Linux with proper tooling - when I look at Go and Rust tools everything
seems to work (I've never tried them - just going off the project readme.md
and videos). I wish this was a bigger priority, but it doesn't appear to be.

It seems like this will all probably get better when the Swift Package Manager
supports iOS/tvOS/watchOS. Most completion tools don't parse the Xcode project
for frameworks, so you don't get completions outside of UIKit/Foundation and
what's declared in your file. I imagine when SPM is ready it'll make it much
easier to parse dependencies and include completions for them.

~~~
chris_7
CocoaPods isn't an official tool so it's not really the Swift team's fault
that it's bad. SPM should certainly have been "done" by now though, Carthage
was put together quicker by a team of volunteers without access to Apple's
resources and generally works perfectly (yes, deferring most of the work to
xcodebuild).

------
matt2000
The original statement regarding Swift 4 was "the primary goals are to deliver
on the promise of source stability from 3.0 on, and to provide ABI stability
for the standard library." I hope this statement is still true. The Swift 3
upgrade was painful, I hope to see more stability out of the language from
here on out.

~~~
melling
It was a bit of work but I would say that it was worth all the changes. I like
Apple's preference to make breaking changes to make the language better.

Apple wrote a decent conversion tool for 2.x -> 3.x; yes it is far from
perfect.

Btw, I documented most of my changes on my blog, in the hopes that the next
person would be able to make their changes in half the time:

[https://h4labs.wordpress.com/2016/09/17/my-ios-10-and-
swift-...](https://h4labs.wordpress.com/2016/09/17/my-ios-10-and-
swift-3-refactor-list/)

Everyone using Swift will soon be on version 3.x. Compare this to languages
like Python where there will need to be a major 2020 conversion to 3.x because
many developers are dragging their feet.

The community needs to accept a little pain or pay for past language design
mistakes for decades.

~~~
hota_mazi
> Compare this to languages like Python where there will need to be a major
> 2020 conversion to 3.x because many developers are dragging their feet.

That's not a very fair comparison. Python is 25 years old and this migration
is being requested after 20 years in existence. There is no way a successful
language can perform this kind of migration at that age without pain. Swift
will be no exception if it's still around and popular in 20 years.

~~~
melling
Yes, I understand that the conversion is in some ways more difficult because
there's a larger legacy code base. However, the conversion has already been
extended 5 years:

[https://news.ycombinator.com/item?id=7581434](https://news.ycombinator.com/item?id=7581434)

A decade long conversion is fine if that is what the community wants. There
are certain drawbacks to this.

I simply like the aggressiveness that Apple has taken. The community can put
"all its wood behind one arrow".

~~~
hota_mazi
I like the aggressiveness too but it's pretty common for very young languages
because the cost is so low. Swift is not doing anything new there.

~~~
melling
Really? I've been programming for almost 35 years and I can't think of many
languages that made such big changes. Java, for example, is still compatible
with 1.0.

~~~
hota_mazi
Java is one language among hundreds that have come out these past twenty
years.

~~~
melling
Yes, I know that. You could provide your examples of some other popular
languages that we all know about. Sure, it's easy to change a language no one
uses, but when you've got hundreds of thousands of users, it's much harder.

------
adamnemecek
Nice to see features I'm pumped about in a decimal version.

~~~
mikeash
Concrete constrained extensions and nested generics are great. These were
pretty big holes in the previous versions, and will help simplify a bunch of
real code.

~~~
adamnemecek
My exact thoughts. These were like 30% of the things I was looking forward to
in Swift 4 so the fact that I don't have to wait is nice.

------
paxcoder
They should finish the free Foundation implementation[1] already which is the
true standard library. Swift is not very useful without it, and they're
talking about 4.0. It seems like Apple's giving their minimum to the community

[https://github.com/apple/swift-corelibs-
foundation/blob/mast...](https://github.com/apple/swift-corelibs-
foundation/blob/master/Docs/Status.md)

~~~
chris_7
I have always considered this a weird effort. Foundation is not Swifty
(delegate protocols with optional methods, etc.). Why do we need a Swift
implementation of NSMutableArray or NSNumber? Just use Array or Int/Double!

Of course, a core Swift library for URL handling is important! And on
macOS/iOS it can be implemented on top of Foundation. But I don't think that
library should come with a bunch of geometry, collections, or number
formatting types as well. µframeworks are Swifty. The SPM documentation says
something like "in general more modules is better than fewer modules", so it's
weird to have a giant framework as an official core library.

~~~
paxcoder
No networking OR file system access in the free implementation.

You'd be hard pressed to find a Swift project that doesn't depend on Apple's
proprietary Foundation because Swift needs it to talk to the world!

I don't understand what IBM is thinking.

~~~
bsaul
Why are you referring to IBM ?

~~~
adamnemecek
They are the face of Swift on Linux.

------
moflome
I find myself now thinking in Swift and coding in ES6... looks like SwiftJS is
dead [0] but notice the Cocos2D folks just released a Swift-to-Android feature
[1]. I really wouldn't mind Swift uber alles... someday.

[0] [https://github.com/shift-js/shift-js](https://github.com/shift-js/shift-
js) [1] [http://forum.cocos2d-objc.org/t/swift-version-is-ported-
to-a...](http://forum.cocos2d-objc.org/t/swift-version-is-ported-to-
android/18186)

------
Entangled
I'm coding all my apps in Swift and I am never going back. Server, desktop,
mobile, tv, watch, linux, embeded, etc. One language to rule them all.

~~~
bsaul
Any news on android development using swift ? The android folder in the
swift.org project has always intrigued me.

~~~
slavapestov
The Android port is maintained by a volunteer, Brian Gesiak. You can ask him
about it on Twitter:
[https://twitter.com/modocache](https://twitter.com/modocache)

------
shujito
I hope that after swift 4 new changes are non breaking

~~~
slavapestov
Swift 4 has a -swift-version flag. When set to 3, all valid Swift 3 code
should compile.

