Alongside efforts to drive coding competency, Apple releases Swift 5 with ABI compatibilit...

Posted:
in Mac Software
This week, Apple's Swift programing language team released version 5 for use in Xcode 10.2, reaching the milestone of ABI stability-- compatibility with code compiled with future versions of Swift compilers-- and introducing new coding features for developers. Swift as a language is maturing alongside Apple's efforts to make code development an attainable skill for students.

Swift


A primary feature of the new release is Application Binary Interface stability across Apple platforms (macOS, iOS, watchOS and tvOS). This means that Swift has matured as a language to the point where there will no longer be huge changes in how its compiler works that breaks compatibility with Swift apps and libraries that have already been compiled into binary.

As a result, Swift 5's ABI stability means app code compiled with today's compiler won't need to be recompiled to work reliably with dynamically linked libraries compiled in future versions of Swift. And that means that apps will no longer need to bundle a known version of the standard libraries they use, and can instead use whatever updated version is provided by the OS. This is already the case with apps written in Objective C.

This, in turn, enables slimming the download size of Swift apps, both in the App Store and in internal deployment testing using TestFlight. Key Swift 5 features were earlier outlined by Apple's head of Swift development Ted Kremenek in John Sundell's Swift by Sundell podcast.

Swift 5 is officially released!

Including...

ABI stability
#"Raw strings"#
Result
"Custom \(string: interpolation)"
dynamicCallable
flattened = try? optionals()

Full release notes: https://t.co/lro3JBqsU9

-- John Sundell (@johnsundell)


The new Swift 5 delivers a series of coding features outlined by Sundell in a tweet (above) and detailed in Apple's official release notes, including the ability to express String literals using enhanced delimiters to support raw text. This clarifies code by removing the need to escape quotes or backslashes.

Apple's decade of Swift

Chris Lattner started the development of Swift at Apple in July 2010, but Swift only made its first public appearance at Apple's 2014 Worldwide Developer Conference. By the end of 2015, Apple had released version 2.2 of new language as open-source software under Apache License 2.0, enabling its use on Linux and other platforms.

Lattner oversaw rapid, significant changes in the language across its first three major versions before officially handing the reins to Ted Kremenek in January 2017. At the time Lattner stated that Kremenek was "one of the quiet but incredible masterminds behind Swift (and Clang, and the Clang Static Analyzer) for many years."

Kremenek has worked at Apple since 2007, and was the principal architect and original engineer of the Clang Static Analyzer that ultimately ended up in Xcode. Between 2009 to 2013, Kremenek worked on the LLVM Front-end team. Since 2017 he has served as senior manager of languages and runtimes at Apple, responsible for implementing the programming language support in Apple's compilers for Swift as well as Objective-C, C, and C++.




Last year, Swift adoption rose to the point of reportedly tying Objective C as a top ten programming language in use among developers on GitHub and Stack Overflow, according to analysis firm RedMonk.

Brining Swift mainstream as an easy to learn language

Apple isn't just watching Swift gain adoption. The company launched its Everyone Can Code initiative in 2016 and has regularly expanded it to empower people with the ability to build their own apps and to teach others how to navigate the "language of technology," positioning Swift as both "great for getting started" and "super powerful."

A year ago, the company announced a partnership with Chicago Public Schools and Northwestern University, to establish a "Center for Excellence" at Lane Tech College Prep High School, an ambitious expansion of its ongoing plans to not only make Swift a popular language among today's developers, but also to reach the next generation coders.

Swift Playgrounds
Swift Playgrounds was designed by Apple to teach code development


The Chicago school now acts as a teaching and learning hub for high school teachers picking up Apple's "App Development with Swift" and "Everyone Can Code" courses designed to introduce Swift programming to the area's nearly 500,000 students. Apple's coding literacy program is also being supported by enterprise employers in the area, ranging from IBM to McDonald's to Rush University Medical Center.

Apple's chief executive Tim Cook stated at the time that "we believe every student should have the opportunity to learn to code and we are thrilled to help provide new learning opportunities for Chicago-area teachers so they can bring coding into their classrooms."

The company has also leveraged its own work in accessibility technology to bring its Everyone Can Code course to students with vision, hearing or physical motor limitations via VoiceOver and Switch Control-- which enables switches, joysticks and other adaptive devices to control what is on the screen.

Accessible Swift courses were launched last fall at the California School for the Blind, the California School for the Deaf, District 75 in New York, Florida School for the Deaf and the Blind, the Hadley Institute for the Blind and Visually Impaired, the Perkins School for the Blind, the Texas School for the Blind and visually Impaired, and the Texas School for the Deaf.

Over 30 U.S. community colleges are now offering App Development With Swift, including Austin Community College in Texas and Northeast Mississippi Community College. Some high schools are adopting Apple's Swift development courses as well.

Dream Corps, an organization founded by Prince and located in Oakland Calif., just partnered with Apple in February to expand its educational and workforce development opportunities with an emphasis on teaching Apple's Swift programming language. The program broadly targets middle schoolers, college students "and beyond" to equip people from underrepresented backgrounds with the job skills to enter the market or drive their own entrepreneurship.

Apple has also outlined plans to bring Everyone Can Code to over 70 schools outside the USA, such as RMIT University in Australia, Harlow College and Plymouth University in the U.K., Mercantec Vocational College in Denmark, Hogeschool van Arnhem en Nijmegen in the Netherlands, Simplon vocational schools in Paris and Lyon, and other educational partners in Austria, Belgium, Czech Republic, Germany, Italy, Spain, Sweden, Norway, Ireland, Luxembourg, Poland, and Portugal.

The company also operates an app accelerator in India, and set up a "Developer Academy" in Italy, run in partnership with the University of Naples Federico II, highlighting its global efforts to expand the talent pool capable of writing apps for its platforms.

Comments

  • Reply 1 of 15
    "Brin[g]ing Swift mainstream as an easy to learn language"
    chasm
  • Reply 2 of 15
    I'm a university professor and I'd love to teach Swift to my students. Unfortunately, very few of them can afford to buy Apple gear (not that I could mandate them to if they preferred Android anyway), and funding for our university is very hard to come by, so having an iPad for every student is absolutely out of the question. I wish Apple would release a web-based version of Swift Playgrounds, or perhaps an Android app.
  • Reply 3 of 15
    MisterKitMisterKit Posts: 292member
    I have dabbled in programming just enough to realize that it was not my calling. This is probably a threshold point for the Apple development field with unity among the Apple platforms. Xcode on iPad is probably close to being a reality.
  • Reply 4 of 15
    hmurchisonhmurchison Posts: 12,307member
    MisterKit said:
    I have dabbled in programming just enough to realize that it was not my calling. This is probably a threshold point for the Apple development field with unity among the Apple platforms. Xcode on iPad is probably close to being a reality.

        Lot's of people find out quickly it's not their cup of tea.  I laugh whenever I read "Swift is an easy language" yeah ...easy for someone that understands the principals of modern day programming languages.   If you're a person that looks at AppleScript and gets queasy coding may not be for you unless you're willing to address your fears. 
  • Reply 5 of 15
    entropysentropys Posts: 1,897member
    "Brin[g]ing Swift mainstream as an easy to learn language"
    Salty.
    beowulfschmidtchasm
  • Reply 6 of 15
    mdriftmeyermdriftmeyer Posts: 7,323member
    MisterKit said:
    I have dabbled in programming just enough to realize that it was not my calling. This is probably a threshold point for the Apple development field with unity among the Apple platforms. Xcode on iPad is probably close to being a reality.

        Lot's of people find out quickly it's not their cup of tea.  I laugh whenever I read "Swift is an easy language" yeah ...easy for someone that understands the principals of modern day programming languages.   If you're a person that looks at AppleScript and gets queasy coding may not be for you unless you're willing to address your fears. 
    For myself, ObjC and C are far more accessible languages than Swift.
    hmurchison
  • Reply 7 of 15
    swineone said:
    I'm a university professor and I'd love to teach Swift to my students. Unfortunately, very few of them can afford to buy Apple gear (not that I could mandate them to if they preferred Android anyway), and funding for our university is very hard to come by, so having an iPad for every student is absolutely out of the question. I wish Apple would release a web-based version of Swift Playgrounds, or perhaps an Android app.
    FWIW I’ve been spending a good chunk of the past six months mostly working in Swift on the server vis-a-vis the Vapor framework. Although I have been working on a Mac, it's by no means necessary. But that said, in a school setting Swift Playgrounds would totally be the way to go. 

    "ObjC and C are far more accessible languages than Swift" That is just bananas.
    macplusplusStrangeDays
  • Reply 8 of 15
    emig647emig647 Posts: 2,416member
    swineone said:
    I'm a university professor and I'd love to teach Swift to my students. Unfortunately, very few of them can afford to buy Apple gear (not that I could mandate them to if they preferred Android anyway), and funding for our university is very hard to come by, so having an iPad for every student is absolutely out of the question. I wish Apple would release a web-based version of Swift Playgrounds, or perhaps an Android app.
    Check out the Swift open source website. Releases for Ubuntu / Debian are maintained. There are also some wrapped versions for Fedora / CentOS out there, but not official releases. https://swift.org/download/

    It is worth noting that the Swift 5 stable ABI does not apply to dynamic libraries (dylib). I believe Apple said that would come later this year. This means you can't really use Swift if you distribute libraries for others to use.
    edited March 27 fastasleeptenthousandthingsauxio
  • Reply 9 of 15
    dewmedewme Posts: 2,200member
    swineone said:
    I'm a university professor and I'd love to teach Swift to my students. Unfortunately, very few of them can afford to buy Apple gear (not that I could mandate them to if they preferred Android anyway), and funding for our university is very hard to come by, so having an iPad for every student is absolutely out of the question. I wish Apple would release a web-based version of Swift Playgrounds, or perhaps an Android app.
    Are you trying to teach iOS app development or Swift programming language? Swift is just a programming language and is available on various platforms. If you want to teach students the Swift programming language there are Swift compilers for Linux and Windows. There are even versions of Swift for Raspberry Pi. Visual Studio Code is a free and fairly lightweight programming editor and IDE that is available on macOS, Linux, and Windows.

    Do universities no longer have computer labs with shared access to computers of various types? I couldn't afford a DEC 10 computer, much less a card punch machine, card reader, disk packs, disk readers, software, and the megawatts of power needed to run everything when I had to learn Fortran 77. Somehow I managed to stand in line for access to all of the required resources. Late at night on a Friday was always a good time to get swift access to the machinery and not have to wait too long for my results to show up in the printout cubbies.

    Swift and iOS apps are very cool, but I'd imagine learning Python programming using a Raspberry PI coupled with some simple data acquisition and analysis would be just a very cost effective and useful option for getting CompSci, EE, and CompEng students plugged into a technology stack that has a high market demand. Maybe throw in a tiny bit of AI and ML to spice things up. It's not an either-or situation, but another option. Too bad about the iPads, because Pythonista on the iPad is a pretty good programming education option. Programming languages come and go into vogue (except for C and C++ which are forever!) and there's nothing particularly groundbreaking about Swift. If your students learn sound (and SOLID) application development techniques they will be able to apply them using any language, whether it's Swift, C#, Python, or better yet, C++ which is still probably the most common language for system-level programming.
    jbishop1039StrangeDays
  • Reply 10 of 15
    ctwisectwise Posts: 46member
    emig647 said:
    swineone said:
    I'm a university professor and I'd love to teach Swift to my students. Unfortunately, very few of them can afford to buy Apple gear (not that I could mandate them to if they preferred Android anyway), and funding for our university is very hard to come by, so having an iPad for every student is absolutely out of the question. I wish Apple would release a web-based version of Swift Playgrounds, or perhaps an Android app.
    Check out the Swift open source website. Releases for Ubuntu / Debian are maintained. There are also some wrapped versions for Fedora / CentOS out there, but not official releases. https://swift.org/download/

    It is worth noting that the Swift 5 stable ABI does not apply to dynamic libraries (dylib). I believe Apple said that would come later this year. This means you can't really use Swift if you distribute libraries for others to use.
    He's talking specifically about Swift Playgrounds.
  • Reply 11 of 15
    netmagenetmage Posts: 293member
    I find the syntax and mindset (philosophy?) of Swift annoying compared to my preferred languages, but it is obviously a huge step up from Objective-C (though I have a soft spot for it as C was my first language and having talked with Brad Cox). Still, it feels to me a bit incoherent compared to C#, though I often rail against the economic limitations that have held improvements and consistency back for C#.
  • Reply 12 of 15
    melgrossmelgross Posts: 31,983member
    ABI stability is the most important feature here. They’ve been promising this for version 3 onward. Good it’s finally arrived. It’s one big thing holding back more commercialization of the language.

    and I always read a few people who can’t wrap their heads around a new language. You get used to doing things a certain way. I remember a long time ago, the question was posed about which word processor was best (this was before drop down menus and mouse driven software). The answer was that the first one you learned was best, because once you learned it, others were harder to learn because they were different. So, not much has changed.
    edited March 28 tenthousandthingsStrangeDays
  • Reply 13 of 15
    MarvinMarvin Posts: 14,232moderator
    netmage said:
    I find the syntax and mindset (philosophy?) of Swift annoying compared to my preferred languages, but it is obviously a huge step up from Objective-C (though I have a soft spot for it as C was my first language and having talked with Brad Cox). Still, it feels to me a bit incoherent compared to C#, though I often rail against the economic limitations that have held improvements and consistency back for C#.
    I find C# easier to deal with too. The main issue for me with Swift is optionals, I think it's the most absurd way of solving a simple problem. Variables can be nil, so they have to be checked. Not checking them leads to crashes. Swift's genius answer is to force checking everything but it's complete chaos even 2-3 levels down in nested types. Swift 5 is supposed to have a feature to help but look at the long discussion threads over this issue that is a complete non-issue in pretty much every other language where it's just expected that people check for nil values:

    https://forums.swift.org/t/se-0230-flatten-nested-optionals-resulting-from-try/16570
    https://forums.swift.org/t/make-try-optional-chain-flattening-work-together/7415
    https://github.com/apple/swift-evolution/blob/master/proposals/0230-flatten-optional-try.md

    I would like to see optional checking reserved for a strict mode and have a non-strict compiler option to treat everything as implicitly unwrapped. It can even be per file with a declaration at the top that says to ignore optional checking. That way you don't have to constantly have the compiler barking errors about optional unwrapping.

    They could even put machine learning to good use and have the compiler run some automated testing in the background to see if potentially nil values or other common errors have been addressed. For a language that is intended to be simple, there shouldn't be huge discussions over things like optional-chaining.

    I also don't see why they don't solve the reason they check for nil types in the first place, which is software crashes. A program doesn't have to crash when it reaches a nil type. It can be forced not to manually so why not do it automatically. If an array has an out of bounds exception, set the assignment to a nil type instead of crashing. If something is trying to run a nil type and it's not expected, don't run it. Log an exception and carry on as normal. Better yet, report it to the app user in a user-friendly way and allow them to send it directly to the software provider to fix it.

    Developing software should be as easy as describing what you want to do in spoken language.

    let message = getMassivelyComplexJSONMessage();
    let nestedVariable = message.thisValue.thatValue.sausage.doesThisValueExist;
    doSomethingWith(nestedVariable);

    // result is logged runtime exception, tried to run doSomethingWith an unexpected nil type, not allowed.

    No messy syntax, productive, doesn't get in your way trying to get work done, doesn't crash.
    StrangeDays
  • Reply 14 of 15

    AppleInsidder: Accessible Swift courses were launched last fall at the California School for the Blind, the California School for the Deaf (there’s two campuses of CSD in California. In two different cities: Fremont and Riverside.) , District 75 in New York, Florida School for the Deaf and the Blind, the Hadley Institute for the Blind and Visually Impaired, the Perkins School for the Blind, the Texas School for the Blind and [V]isually* Impaired, and the Texas School for the Deaf.

    *fixed that for you. ;) 

    I graduated from Texas School for the Deaf in Austin, Texas in 1999. Texas School for the Deaf is the large campus. It have K-12 schools (Elementary, Middle and High School) on a single 78 acres campus with dormitories for High School and Middle School. I think that elementary school students is for day students who live with their parents in Austin area. But not so sure. That school is down south of Congress Avenue from the State Capitol building. TSD established in 1856 which is the oldest school that still in operation in Texas. The State Capitol building construction end in 1888. 

  • Reply 15 of 15
    StrangeDaysStrangeDays Posts: 8,818member
    MisterKit said:
    I have dabbled in programming just enough to realize that it was not my calling. This is probably a threshold point for the Apple development field with unity among the Apple platforms. Xcode on iPad is probably close to being a reality.

        Lot's of people find out quickly it's not their cup of tea.  I laugh whenever I read "Swift is an easy language" yeah ...easy for someone that understands the principals of modern day programming languages.   If you're a person that looks at AppleScript and gets queasy coding may not be for you unless you're willing to address your fears. 
    For myself, ObjC and C are far more accessible languages than Swift.
    Opposite, here. Swift reads much more naturally to me and has far less Arcane Lore of the Techno Priest. Granted, I didn't cut my teeth on C and instead began coding in the web age learning JavaScript and VB during college (ignoring HS programming course on Pascal etc), followed by PearlScript and C# in the workforce. Swift is similar enough to JavaScript and C# that it's easy to slip into. It's the right choice for Apple IMO.
    edited March 29
Sign In or Register to comment.