Slashdot Mirror


Swift: Apple's Biggest Achievement For Coders

GordonShure.com writes: Despite its publicity and hype being rather quiet by Apple standards, the Swift programming language has attracted praise since its release last year. Swift is one of the few Apple products that represent a departure from the hardware-led Steve Jobs approach to the business. If this year's survey of coders by Stack Overflow is anything to go by, it looks as if the language might have potential to really shake things up in a landscape which has been little changed since the 1990s. Might the days of Apple programmers relying upon objective C be numbered?

6 of 337 comments (clear)

  1. One more in a crowded field by TWX · · Score: 5, Insightful

    How's Swift's cross-platform suitability?

    There are two Apple platforms, one popular Google platform, one less-popular Google platform, plus Microsoft's platform. Is Swift suitable for writing applications for all? If not, developers would be writing for a limited, albeit popular platform, but limited to a certain subset nonetheless.

    --
    Do not look into laser with remaining eye.
    1. Re:One more in a crowded field by IamTheRealMike · · Score: 5, Interesting

      Is Swift suitable for writing applications for all? If not, developers would be writing for a limited, albeit popular platform, but limited to a certain subset nonetheless.

      No, it's Apple specific. However that's OK because there's a language which is much like Swift, except it runs on pretty much every device you might have.

      That language is new. It's called Kotlin, and it is from JetBrains, the makers of the highly popular IntelliJ series of IDEs (+ WebStorm, PHPStorm, RubyMine, PyCharm etc).

      Kotlin targets the JVM and JavaScript. It interops perfectly with Java. That means code written in it runs on Windows, Mac, Linux and Android. Additionally, via the RoboVM project, JVM bytecode can be compiled to native ARM iOS/OSX binaries. There is no JIT compiler. RoboVM provides bindings to all Objective-C APIs on iOS so you can build native UIs and access all the same functionality as a native app. Programs written this way are on the app store, so Apple is cool with the technique.

      Kotlin has a clean, concise syntax and many modern features that match those in Swift. For example it has nullability/optionality integrated with the type system. It has Markdown comments. It has extension functions. It has some support for pattern matching. It has named parameters. It has the ability to define "data classes" that have easy immutability, content equality, hashcodes, serialization etc all in a single line of code. It has type inference and compile-time inlined lambdas, so you can do high performance functional programming with it. It has features to support complex DSLs. It has a full IDE with many built in refactorings, online static analysis, and via the JVM it has high quality CPU/memory profilers and debugging support.

      In short, programming with Kotlin is much like programming with Swift, except you have better tools, an IDE at least as strong as Xcode and in my experience stronger, and you can write apps with it that are indistinguishable from native iOS and Android apps.

    2. Re: One more in a crowded field by Feral+Nerd · · Score: 5, Informative

      Most developers? I don't know who you have been talking to or what you have been reading (maybe you work at Apple?), but the Android market share is much greater than the Apple market share. Plus it doesn't take much for a Java dev to turn his/her skills to Android, and C is the only language more popular than Java. In reality I doubt either platform will have issue finding developers.

      He is talking about profit potential, not who's got his OS installed on the most devices. The implication is that iOS development is more profitable than Android development which is something that I have heard from more mobile developers than just him.

  2. Quiet schmiet, frosty already by Hognoxious · · Score: 5, Funny

    Despite its publicity and hype being rather quiet by Apple standards

    I haven't seen it mentioned on CNN or the BBC, but there's about a dozen stories about it per day on a former tech new website.

    In fact, it's pushed 3D printers off the number one spot.

    --
    Confucius say, "Find worm in apple - bad. Find half a worm - worse."
  3. Re:Yes, but it will be a while. by Lunix+Nutcase · · Score: 5, Informative

    Obj-C is on the way out.

    Uhh, no. So much of the system libraries on both OS X and iOS are written in Objective-C and they aren't going anywhere. Also, all the new APIs of iOS 9 and OS X 10.11 are still written in both C and Objective-C with Swift bridge headers. Basically, it's the opposite of what you claim.

    I'd guess that we're about a year away from the point where the majority new code at Apple is written in Swift.

    Maybe at the application level, but not for system libraries.

  4. Re:Frustrating type conversions by 0123456 · · Score: 5, Interesting

    That would probably have prevented the annoying bug I ran into a few years ago where someone copied a 64-bit time_t to a 32-bit int, did some arithmetic, and then copied it back to a 64-bit time_t, requiring us to update firmware at all customer sites to fix it. If they had to explicitly convert, they'd almost certainly have realized they were doing something wrong.

    That bug alone probably cost us more money than the time required for programmers to always explicitly convert types.