10 ms·
Swift 4.1 Released
- mlex 9y agoI don't know if anyone who can edit the blog is reading this, but the link to "SE-0186 Remove ownership keyword support in protocols" is wrong, it should point to https://github.com/apple/swift-evolution/blob/master/proposals/0186-remove-ownership-keyword-support-in-protocols.md https://github.com/apple/swift-evolution/blob/master/proposa...
- lgg 9y agoThanks for the heads up. It should be taken care of now.
- protomyth 9y agoIt would be helpful if Apple did a review of the sample code in the developer's library and fix all the software that won't even compile anymore. It doesn't help people trying to learn this language if the sample code won't work.
- dep_b 9y ago> Swift 4.1 is a minor language release. It is source compatible with Swift 4.0. Nothing should break?
- protomyth 9y agoGo to the Apple developer page of sample code https://developer.apple.com/library/content/navigation/#section=Resource%20Types&topic=Sample%20Code https://developer.apple.com/library/content/navigation/#sect... and see how much actually compiles, its not a lot.
- saagarjha 9y agoA lot of sample code is still Swift 1 or 2 code, which is not source compatible.
- ianai 9y agoAm I the only one who finds the rapid source incompatibilities problematic? Like maybe a language shouldn’t move so fast or be better nailed down before production.
- matthewmacleod 9y agoYou have two choices: bake the language fully before release, or push out what you have and get the community involved. I’d argue the second option is almost universally better.
- ianai 9y agoReasoning about effect aside, I walked away from an iOS project (personal) primarily because the language moved so fast it lot me.
- dep_b 9y agoSwift changed less between 3 and 4 than between 1.0 and 1.1. The last two years or so have been fine for me.
- rimliu 9y agoYou could do it Objective-C.
- matthewmacleod 9y agoI would say that a lot of people jumped on board with Swift before it should really have been used so widely. Objective C was - and still is! - a totally acceptable way to build an app for iOS.
- saagarjha 9y agoLike another commenter has mentioned, Swift is now almost nearly source compatible. The compiler already provides support for any version of Swift back to version 3.2.
- e28eta 9y agoI saw a couple regressions, but I believe that was the goal
- alexashka 9y ago+1 I'd also make a humble suggestion to have a dedicated sample code person who's well versed in Swift, to make the sample code consistent and well documented. To have sample code for every new feature, etc. This should not be a coop or someone doing it in hindsight - the number of hours people spend re-inventing how to do infinite scrolling tableviews (one simple example) is sad - every new developer has to re-invent the wheel it seems. This leads to people using third party libraries for things that need no libraries at all, and then before you know it, you're swimming in cocoapod soup, every time you join a new project, and the soup is 50% new ingredients every other time too!
- saagarjha 9y ago> a dedicated sample code person who's well versed in Swift, to make the sample code consistent and well documented I’m pretty sure they have multiple people with a role like this (I know they have one at least, since I’ve met him).
- Hamuko 9y agoYeah, Apple's developer documentation is definitely subpar. They don't maintain the samples well (if there are any) and they are a bit on the lazy side when it comes to documenting class methods and variables. Sometimes they just tell you that something exists.
- melling 9y agoI’ve got a couple dozen small Swift 4 examples on Github for anyone looking for sample code: https://github.com/melling/ios_topics/blob/master/README.md https://github.com/melling/ios_topics/blob/master/README.md
- tyingq 9y agoIs "server side Swift" becoming less niche? I'm not clear on why it isn't competing more with Go and Rust.
- saagarjha 9y agoMy impression has been that Swift is still very much seen as an “Apple” language, rather than a cross platform one. Another issue is that there are some operations that lead to crashes if they detect illegal behavior, in the name of providing safety and consistency. Some feel that this kind of behavior is counterproductive in a server environment because it would lead to the server keeling over if something goes wrong.
- giancarlostoro 9y agoTooling outside of Mac I imagine is lacking as well. I also asume libraries outside of Mac too? Strong standard libraries make languages easier to adopt. Go had a web server out of the box removing the whole "which web library do I use?" element out of the equation.
- tyingq 9y agoAhh, yes. That makes sense. No batteries included.
- saagarjha 9y agoSwift on Linux has access to a substantial portion of Foundation as well as any other C libraries, such as libc.
- ttflee 9y agoThere are a lot mismatches. For example, I reported a bug about CFRunLoopMode, where the original C-based CF used a comparison of pointer address to determine the equality of two run mode names. The original C version actually compared using the identity rather than equality as the commonModes was defined as a static CFStringRef (CONST_STRING_DECL(kCFRunLoopCommonModes, "kCFRunLoopCommonModes")). Of course this is an optimization for speed on Mac but this is, unfortunately, not supported in Swift and its replication of CF, because in Swift it has to be a public static String. As for today you cannot use commonModes in Linux.
- deleted 9y ago[deleted]
- edragoev 9y agoRE: Server side Swift Linux is second class citizen as far as Swift is concerned for sure. I had to jump through a few hoops to make sure my library works on both Linux and iOS. Just tried v4.1 and everything compiled cleanly: http://pdfjet.com/swift/PDFjet-Swift-2018-03-30.zip http://pdfjet.com/swift/PDFjet-Swift-2018-03-30.zip BSD licensed code, 100% written in Swift (I went through the trouble of writing the compression code in Swift since the compression classes were missing from the Linux distribution and some older versions of iOS ) - give it a try.
- tinus_hn 9y agoI don't quite understand why they are putting specifics like detecting the iOS simulator in the core language.
- yoz-y 9y agoProbably because "how do I detect simulator" is one of the most asked questions about swift. So Apple uses the leverage they have over the language. I hope though that the way the targetEnvironment condition is implemented is that the 'simulator' exists only in the iOS library.
- Someone 9y agoThey want functionality that is similar to the C preprocessor’s #if, but different in that they want to require both branches to syntax check. They also want to locally evaluate the equivalent of such #if expressions (in contrast, in C, #if X requires preprocessing the file. That can mean reading dozens of header files, and is dependent on compiler flags) I think this is a pragmatic way to accomplish that. It restricts you to conditions that Apple has deemed useful, but makes it easier to write good tooling.
- pjmlp 9y agoBecause in the context of conditional compilation it is just yet another target.