Follow Slashdot blog updates by subscribing to our blog RSS feed

 



Forgot your password?
typodupeerror
×
Programming Apple

Swift: Apple's Biggest Achievement For Coders 337

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?
This discussion has been archived. No new comments can be posted.

Swift: Apple's Biggest Achievement For Coders

Comments Filter:
  • by TWX ( 665546 ) on Sunday June 14, 2015 @02:14PM (#49909791)
    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.
    • Re: (Score:2, Interesting)

      by Anonymous Coward

      No, and that's what Apple wants.

      Most developers will pick Apple over Android. Then you have to rewrite the code for Android. Apple will get first release on a lot of apps, just what they prefer.

      • by Anonymous Coward

        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.

        • by ShanghaiBill ( 739463 ) on Sunday June 14, 2015 @02:46PM (#49909927)

          the Android market share is much greater than the Apple market share.

          For phones, yes. For apps, no. The average iOS user buys far more apps than the average Android user.

        • by Feral Nerd ( 3929873 ) on Sunday June 14, 2015 @02:48PM (#49909951)

          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.

        • If you are a developer, market share shouldn't concern you too much, as it changes every month when something new comes to market. Installed base is what most people would go by.
          There are very few reliable means of collecting installed base stats, but a cross-platform SDK from an ISV who isnt affiliated with any of the platform providers, powering many popular games would probably be a good first stop [unity3d.com]

          • Not really, because iOS has native 3D APIs. Unity is used by some of the developers that are multi-platform. But those developers who are iOS only, and there are many, are probably not using Unity.

        • ... the Android market share is much greater than the Apple market share ...

          And app revenue is 1/4 to 1/5 on Android compared to iOS. Its actually still more profitable on the iOS side due to its users spending more per app.

          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.

          And C/C++ is probably what the core of your app should be written in so its portable to iOS, Android, Linux, Mac OS X and MS Windows. Only the user interface code needs to use java, swift, or objective-c. And its often best to just rewrite the UI in the language of the API for each platform.

          • Or use Qt for the frontend.

            Honestly: it makes no sense at all to rewrite GUI code.

            50% or more of the code for an app is GUI ...

            • by laird ( 2705 )

              QT gives you a "least common denominator" GUI everywhere. If your UX matters at all, you're better off writing a native GUI layer for iOS and Android, so your app doesn't suck compared to competitors.

            • Or use Qt for the frontend.

              Honestly: it makes no sense at all to rewrite GUI code.

              50% or more of the code for an app is GUI ...

              No, it absolutely make sense to use the native api of a platform to create the user interface. Otherwise you app does not look or behave as expected and that has been shown to be harmful to an app's success. So if its an internal enterprise app that people will be told to use, fine, take that shortcut. However if your app's success depends on being embraced by the public absolutely beware of these one-size-fits-all solutions. Your app must look native, it must look current, it must support all the built-in

              • Or use Qt for the frontend. Honestly: it makes no sense at all to rewrite GUI code.

                No, it absolutely makes sense to use the native api of a platform to create the user interface. Otherwise your app does not look or behave as expected and that has been shown to be harmful to an app's success. So if its an internal enterprise app that people will be told to use, fine, take that shortcut. However if your app's success depends on being embraced by the public absolutely beware of these one-size-fits-all least-common-denominator solutions. Your app must look native, it must look current, it mus

            • Apologies, I hits the submit button prematurely. Please read my response to my other post, its the full response, the first was a work in progress.
        • by SpaghettiPattern ( 609814 ) on Monday June 15, 2015 @03:50AM (#49912423)

          ... and C is the only language more popular than Java...

          Nitpicking here. I started with C nearly 3 decades ago, I switched to Java but I'd be able to pick up C again in a very short time. Large parts of large/huge systems I design in C structures as they provide a nice abstraction of the underlying hardware. No matter how much I like C, it's no longer number 1 when considering the number of programmers involved. It's "too technical" for application programmers. Considering that financial programmers push the numbers and that they are moving from COBOL to Java, I see Java as the COBOL of the future. The upshot is that Java is good enough to do almost anything and much more elegant than COBOL.

      • Waaay easier to slap something together in Java and then do the iPhone app. So much easier to make adjustments in Java.
        • by fbartho ( 840012 )

          Hahahahaha

          • by euroq ( 1818100 )

            First of all, I'm a developer.

            So, I work for a company who wants the product on all platforms... we dev on all platforms, and we even outsourced a windows app (ha!). But anyways, it's true. It's way faster to iterate in Android than it is in iOS. So our features come out on Android first.

            I can hear everyone saying "get better iOS developers!" Well, maybe. But I don't think so. The devs are pretty much equally capable on both sides. Maybe Swift will change things, but the reality is is that Android developme

      • by jblues ( 1703158 )

        You can currently write Android apps in Swift with Apportable [apportable.com]. Although Apple doesn't blow a whistle about this, most of the low-down parts of the stack are open-source. Moving up, Apportable have implemented in-house versions of Foundation, UIKit and so forth.

        In the coming months, Apple will be releasing Swift for Linux, though its not clear whether that will include Foundation and UIKit. If not I can see the Apportable ones possibly being open-sourced in the future.

    • by IamTheRealMike ( 537420 ) on Sunday June 14, 2015 @02:46PM (#49909935)

      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 [kotlinlang.org], 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 [robovm.com], 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.

      • Oops, I forgot something important.

        There is a simple web based IDE that you can use to experiment and learn the language at try.kotlinlang.org [kotlinlang.org]. For me it seems there's a layout issue with Chrome right now, but it works fine in Safari.

      • Re: (Score:3, Informative)

        by gnasher719 ( 869701 )

        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.

        Well, pretty much any device accept the odd iPhone here and there?

        Looks like they are trying to create a Swift clone. Excuse me, but I think I prefer the real thing. Which will quite soon run everywhere, unless Google throws its toys out of the pram. And which has the brains of LLVM behind it. And most importantly, which is in actual use. Maybe Swift will never be as good as Kotlin's claims, but Kotlin will never be as good as Swift.

        • by mfearby ( 1653 )

          Exactly. I've grown tired of all these new languages that claim to be better than the real thing. You're far better of using "the real thing", and I've never liked IDEA as an IDE (mind you, I think XCode's code editor and workspace tabs suck, too, but I've learned to tolerate it).

        • Re: (Score:2, Informative)

          by Anonymous Coward

          Looks like they are trying to create a Swift clone. Excuse me, but I think I prefer the real thing. Which will quite soon run everywhere, unless Google throws its toys out of the pram. And which has the brains of LLVM behind it. And most importantly, which is in actual use. Maybe Swift will never be as good as Kotlin's claims, but Kotlin will never be as good as Swift.

          Kotlin has been released in 2011, so I don't think it tries to be a clone of Swift. It's more a "Java replacement", like Ceylon, Gosu or Fantom, which is not a bad idea when you have something like Oracle Corp which get to decide how to manage an open technology (Java...)

      • Looks sharp. They need to hire a Marketing Dork to come up with a name that either means something to someone besides Mrs. Kotlin, or is otherwise snappy and memorable. Otherwise, it's going to be hard to gather any mindshare.

    • by itsdapead ( 734413 ) on Sunday June 14, 2015 @05:13PM (#49910533)

      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.

      Well, Apple just announced [opensource.com] that they are planning to open-source Swift and will be also be releasing a Linux version of the compiler. So the language itself isn't going to be Apple-only for much longer.

      However, that only solves the language problem - the big divide between platforms is the totally different APIs that developers have to learn. Frankly, that's usually a bigger learning curve than picking up a new language.

      Mind you, you can say the same for most of the big languages - off the top of my head only Java (and maybe Javascript/HTML5) come with baked-in crossplatform APIs suitable for writing GUI applications.

      • by Chalnoth ( 1334923 ) on Sunday June 14, 2015 @08:00PM (#49911079)

        Just as with Objective-C, I doubt that hardly anybody else will make use of the language.

        The problem is it just doesn't have all that much to offer for projects that are already making use of other languages. It's got a few slick features, but it can't really stand out all that much and the library support is going to be very far behind more mature languages for a long time (if not forever).

        • Objective-C never took off elsewhere because C++ was pretty much an equivalent (lacking runtime introspection but making up for that by being a little faster).

          Swift on the other hand has a lot of desirable features, that are not available elsewhere. I've listed some in a post under the last Swift story we had. So either some other language takes on these features, or at least some non-Apple programmers are going to be attracted to Swift.

          Library support is easy, as Swift can adopt C based libraries. Either c

          • Eh. As near as I can tell, Swift is very similar to Go, except without the channels but with a more traditional generics system. I have yet to see anything particularly different about it except for a few slick string manipulation operations. But those really aren't of that much value.
    • by SuperKendall ( 25149 ) on Sunday June 14, 2015 @05:19PM (#49910553)

      In the keynote they announced Swift being open source later this year, including releasing versions for Linux...

      Having done over a decade of backend work in the past, I think it would make a pretty good server language also. It's all about the libraries and frameworks that support what you are trying to do.

    • "How's Swift's cross-platform suitability?"

      Apple just open-sourced Swift, in hopes that it will be ported to other platforms.

    • How's Swift's cross-platform suitability?

      Well its now available for Linux and it has been open sourced.

      But more importantly its compatibility is largely irrelevant. Keep the UI and core code separate. The core of an app/game should usually be written in C/C++ for compatibility. Its not all that difficult to keep core code in C/C++ compatible for iOS, Android, Mac OS X, Linux, and MS Windows. Been there done that plenty of times. And its often best to just go with the language that is native for the platform with respect to the UI code.

  • by Hognoxious ( 631665 ) on Sunday June 14, 2015 @02:16PM (#49909799) Homepage Journal

    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.

    • Swift was mentioned on CNN here [cnn.com]

      It was also mentioned on BBC here [bbc.com]...

      I've seen mentions of it all over, on a lot of non-tech web-sites. That has been kind of amazing.

      Coding is starting to matter more, especially as black hats affect more and more people - so people are starting to care about it more generally, even if they don't really understand details yet.

  • Comment removed based on user account deletion
    • by Lunix Nutcase ( 1092239 ) on Sunday June 14, 2015 @02:42PM (#49909905)

      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.

      • So much of the system libraries on both OS X and iOS are written in Objective-C and they aren't going anywhere.

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

        So for a long time people at Apple will keep using the giant codebase they're familiar with but app developers, Apple and otherwise, will use Swift going forward. For the Universe minus Apple's OS developers, the statement is true.

        • Yes, they will keep using the very language that is being claimed to be "on the way out". Sort of like how Microsoft never stopped using C or C++ for system libraries and APIs even after .NET came out.

          • Being "on the way out" means new code.

            Heck there's still old code written in Cobol that's still in use by some organisations, but you wouldn't argue that Cobol isn't on it's way out.

            And yes, it's only a matter of time before Apple is writing new libraries in Swift. Swift is absolutely intended to replace system code as well as app code.

        • Maybe. I still prefer Objective-C.
          • Still early days. Swift is mature enough for developers that are new to iOS/OSX to use. As yet there's no a huge incentive for Objective-C developers to change, especially when working on existing projects. But the time will come when creating a new project, and Swift will seem like the natural choice.

        • There's a fairly good chance that Apple is going to push to have their OS transitioned over to Swift.
          • I doubt it. There's rarely a good reason to re-write existing code. I think they'll start doing new libraries in swift. Maybe even new APIs in existing libraries. But I don't see them doing a whole rewrite of Cocoa.

      • Comment removed based on user account deletion
  • by antiperimetaparalogo ( 4091871 ) on Sunday June 14, 2015 @02:48PM (#49909949)

    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

    "Most Loved"

    • Swift 77.6%
    • C++11 75.6%
    • Rust 73.8%
    • Go 72.5%
    • Clojure 71.0%
    • Scala 70.6%
    • F# 70.1%
    • Haskell 69.5%
    • C# 67.2%
    • Python 66.6%

    "Most Wanted"

    • Android 17.7%
    • Javascript 15.4%
    • Python 14.8%
    • Node.js 14.6%
    • AngularJS 13.2%
    • Java 10.5%
    • iOS 9.4%
    • Arduino / Raspberry Pi 8.5%
    • Swift 8.5%
    • C# 8.0%
  • Swift in its first year has become the preferred language for developing on the Apple platform. Objective-C is being "improved" but only as a bridge to support interoperability with improvements that are being incorporated into Swift.

    There is a lot of Objective-C code that will have to be maintained, and over time it will be replaced with Swift code... but it won't disappear overnight. In a year all new development is likely to be done in Swift, while Objective-C is just maintained.

    Eventually -- in many years time as Objective-C code is revisited it will be phased out.... but it will be a very long time-frame.

    If you are starting development on a new application - you would have to be very short-sighted to pick Objective-C as a starting point.
    • Objective-C is hardly "legacy" considering most, if not all, of the new system libraries and APIa in both iOS 9 and OS X 10.11 are written in Objective-C. Not a single system library or service is written in Swift.

      • That will change over time. The code for the APIs (new or not) have been under development for a while - some of it ported from one platform to another, some of it built using other APIs...... as such developing new APIs on a system in flux before or during the first year would be a little risky. As all new application development (including bundled) applications - the majority of the application code itself will be swift based. At that point the only reason to continue to build new APIs (i.e. totally
        • That will change over time.

          No, it won't. Unless you're going to claim that Apple is going to stop supporting C development on their systems. Because the only way to support C in this supposed future where system frameworks will be written in Swift is that Objective-C will still need to be around.

          • This mixing of C and Objective-C for the sake of making a point is ridiculous.

            Objective-C IS NOT C. Darwin the operating system kernel underneath the UI is written in C, C++..... not Objective-C.

            The UI APIs and Objective-C are what we are talking about... So no, Objective-C to continue being used going forward is not in the same league.
          • by Bogtha ( 906264 )

            Because the only way to support C in this supposed future where system frameworks will be written in Swift is that Objective-C will still need to be around.

            That's not true. While it's possible to use Objective-C frameworks from C, in practice, nobody does this. People writing C for Apple platforms don't usually call out to Objective-C from C, they call into their C from Objective-C. Entirely replacing Objective-C with Swift won't change this - you can call into C from Swift just as you can call into

          • What are you talking about? Swift supports C libraries just as much as Objective-C supports C libraries.

            Maybe, when Apple release Swift for Linux, you can actually have a play with it, and begin to know what the fuck you're talking about.

  • It's clear that Apple wants to replace Obj-C with Swift. So eventually it's going to happen. Since the Obj-C tools will not be maintained.

    Will Swift make inroads outside the Appleverse. Some but nowhere near as much as Apple and it's fanboys are hoping.

    • Will Swift make inroads outside the Appleverse. Some but nowhere near as much as Apple and it's fanboys are hoping.

      Why that needless attempt at an insult? Especially when it's obvious that you haven't thought this through. You also spelled "fanboi" wrong.

    • People keep on about Apple dropping support for Objective-C, which seem ridiculous to me. A huge number of OS X's existing APIs are Objective-C based. And if nothing else, these are likely to remain for the next decade or two simply to maintain compatibility with today's apps, nearly ALL of whom are written in Objective-C. There are also a number of APIs Apple relies on that are C based as well, which requires either C/C++ or Objective-C to interface with. You seriously think Apple is going to replace O

  • by tylersoze ( 789256 ) on Sunday June 14, 2015 @05:37PM (#49910639)

    I don't know, most long time iOS developers I know, including myself, aren't really jumping all over themselves to adopt Swift. I mean the writing is on the wall obviously, and Apple will eventually drop Objective-C down the road, so we'll have to eventually adopt it. That's the attitude I'm seeing among people I know. Personally I don't particularly like it that much and it seems to be solving problems that don't need a solution, like fucking optionals. That said, there are features of the language I like but I wish they had just continued to develop and refine Obj-C, honestly just getting rid of the bracket syntax and adding some of the features from Swift would satisfy me. Apple characterizing Swift as "Obj-C without the C" couldn't be more wrong. It's more like "C++ without the C" or "Obj-C without the Small Talk"

    Most of the talk about Swift seems to be coming from people that aren't iOS developers and don't really have any idea what they're talking about.

    • solving problems that don't need a solution, like fucking optionals.

      Doesn't need a solution? The fact that you don't know when you receive a pointer whether it's allowed to be nil? It's a huge problem. Always has been. A very common cause of bugs. A very common case of error handling that is not done when it should be or done when there is no need.

      And Obj-C translating a method called on a nil pointer to no-op generally just hides problems.

      (I'm an iOS Obj-C developer on one of the most popular apps on the store. We haven't started using Swift yet, but now 2.0 is out I'll be

  • Okay, poll... (Score:3, Insightful)

    by Chris Mattern ( 191822 ) on Sunday June 14, 2015 @06:15PM (#49910725)

    How much did Apple pay for this article?

  • Swift may "shake things up" in the Apple world, but to other platforms, it's just another language among many. The fact that Apple has focused almost exclusively on Objective-C means it's a major change for their developers, but no other platform has ever had such a single-language focus and won't be affected anywhere near as much.

    I realize that to Apple fanbois, Apple and it's platforms are the world, but to the rest of us, they're just one of many fish in the IT sea.

A Fortran compiler is the hobgoblin of little minis.

Working...