The Swift unveiling

Discussion in 'Mac Programming' started by mazz0, Jun 2, 2014.

  1. mazz0 macrumors 68000

    mazz0

    Joined:
    Mar 23, 2011
    Location:
    Leeds, UK
    #1
    Anyone else notice the slight pause followed by the complete lack of excitement following the "we wondered what Objective C would be like without the baggage of C" line?

    I know what I was thinking, and I assume a lot of other people: "the problem with Objective C isn't the C parts!"

    Now however, what I've seen of Swift looks beautiful!

    What do people think?
     
  2. Red Menace macrumors 6502

    Red Menace

    Joined:
    May 29, 2011
    Location:
    Littleton, Colorado, USA
  3. int3 macrumors member

    int3

    Joined:
    May 19, 2014
    Location:
    Portugal
    #3
    Looks like visual studio developed 15 years ago. :p
    I think apple should go with this. Make a soft language to compete with microsoft.
     
  4. mazz0 thread starter macrumors 68000

    mazz0

    Joined:
    Mar 23, 2011
    Location:
    Leeds, UK
    #4
    Sorry int3, I have no idea what you mean. Visual Studio isn't a programming language. Also, what's a "soft" programming language? What do you mean by "I think apple should go with this. Make a soft language to compete with microsoft." - could you rephrase that as I don't understand you?
     
  5. grandM macrumors 65816

    grandM

    Joined:
    Oct 14, 2013
    #5
    it also made me think of visual basic more than a decade ago
     
  6. mazz0 thread starter macrumors 68000

    mazz0

    Joined:
    Mar 23, 2011
    Location:
    Leeds, UK
    #6
    What did? I was commenting on the language, not the IDE. I'm confused.

    ----------

    I'm not very familiar with Visual Studio by the way, before Xcode I mostly programmed in Java.
     
  7. grandM macrumors 65816

    grandM

    Joined:
    Oct 14, 2013
    #7
    "Visual Basic is a third-generation event-driven programming language and integrated development environment (IDE) from Microsoft for its COM programming model first released in 1991"
    The term was used for the language too
    You didn't have to say which type a variable was and so on (was recommended though)
     
  8. ArtOfWarfare macrumors G3

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #8
    I've never bothered learning Microsoft's technologies because they don't seem to have any advantage over Java, but my understanding is that Visual Basic is a language while Visual Studio is an IDE.

    Perhaps I'm mistaken.

    Regarding my reaction:

    The problems with Obj-C is the language feels like it was taped onto C. A lot of irritating problems and syntax in Obj-C had to do with how closely it was related to C. IE, why were literals always prefixed with an @? Because literals were already defined in C without the @. Why did ever object have a *? Because it was implemented as a C pointer.

    So far, my reaction to Swift (I'm 182 pages into the 860 page guide) is that it's certainly an improvement over Obj-C, but I think I still prefer Python.
     
  9. grandM macrumors 65816

    grandM

    Joined:
    Oct 14, 2013
    #9
    - Indeed: visual basic = language/ visual studio = ide
    - I remember when I started the Kochan book a while ago thinking to myself "luckily I learned C at university" or I wouldn't get this. And you could even use & to pass by reference. So you are definitely right. Objective-c was quite a hurdle for me to cope with. Shame swift didn't come sooner. Because now employers will demand newbies to know both.
     
  10. int3 macrumors member

    int3

    Joined:
    May 19, 2014
    Location:
    Portugal
    #10
    Everyone got it wrong. LOL
    First I main C#. I'm a programmer. I know Visual Studio is an IDE ...
    What I meant is that a "soft" (easy to read and code) would be nice on os x. C# is a simple language for me, I would like to see a simple and powerful language with awesome framework on mac to make easy and fast and useful apps.
    For mac I use C++ with Qt. And for windows I use C#.

    ----------

    forgot to quote.
     
  11. sfwalter macrumors 68000

    sfwalter

    Joined:
    Jan 6, 2004
    Location:
    Dallas Texas
    #11
    Does this mean that I can write an entire iOS application exclusively in Swift and there's no need to write one line of Objective C code?
     
  12. mrxak macrumors 68000

    Joined:
    Apr 16, 2004
    Location:
    Drifting through space in a broken escape pod
    #12
    Don't get me wrong, I love C and all its off-shoots that I've tried. I, too, hesitated a bit when I heard that line during the keynote. But it actually does make sense to start fresh. There is certainly C baggage in Objective-C that makes certain parts of Objective-C kind of a pain.

    I've only just begun to look around at a few code examples in Swift and I'll reserve judgement until I hear from certain tech sites that will no doubt delve much deeper into the documentation than I'm prepared to do right now. Still, I'm excited. It's not every day that a big company like Apple comes out with a new flagship programming language. I'm sure some big developers are nervous, and some people with half-finished projects are kicking themselves, but to me this says Apple has its sights set on the future.

    I wish they had spent more than 10 minutes on it at the end of the keynote, though I'm sure there's a lot of stuff going on in the WWDC sessions on Swift. I'll start reading through the eBook and some of the pages on the Apple dev site. All our questions will be answered, I'm sure, in time. Right now, though, I'm just excited.
     
  13. dtlee1974 macrumors regular

    Joined:
    Apr 2, 2010
    #13
    I prefer Python myself. But, Swift is one hell of a lot more Pythonic than Obj-C. My boss asked me what Swift looked like and I told him, "Python with braces." It might not be that similar, but I think I can learn to like the syntax.
     
  14. sfwalter macrumors 68000

    sfwalter

    Joined:
    Jan 6, 2004
    Location:
    Dallas Texas
    #14
    Swift is pretty cool. I think I'm going to enjoy programming in it alot more than Objective C.
     
  15. Madd the Sane, Jun 2, 2014
    Last edited: Jun 2, 2014

    Madd the Sane macrumors 6502a

    Madd the Sane

    Joined:
    Nov 8, 2010
    Location:
    Utah
    #15
    Short answer: yes.

    Longer answer: yes, but you will still have to use the CocoaTouch Frameworks.

    I did wonder why Apple implemented Modules in Objective C. "Wouldn't a precompiled header do the same thing?" I thought. It didn't prevent me from using modules, though. Although there are a few projects that do have variable names clashing with system headers.

    One thing that I will find annoying is the fact that Objective C classes can't be subclasses of Swift classes, but vice versa is fine. This is probably due to technical limitations, though.
     
  16. crewkid89 macrumors regular

    crewkid89

    Joined:
    Jun 16, 2011
    Location:
    United States
    #16
    I got super excited when I saw swift and have already started to read the iBook docs. As an educational technology specialist, I more dabble in programming than anything else. Objective-C was always too steep of a learning curve for me to get over with everything else on my plate. I am excited for swift as it reminds me of Python and Livecode so far.

    I am now wondering if GUI programs are within my grasp in Xcode. What will it be like learning Cocoa with Swift?
     
  17. Madd the Sane, Jun 2, 2014
    Last edited: Jun 2, 2014

    Madd the Sane macrumors 6502a

    Madd the Sane

    Joined:
    Nov 8, 2010
    Location:
    Utah
    #17
    There will be some parts of the implementation that will be similar to other Cocoa apps, such as setting a delegate for the application class (that is a subclass of NSObject, if I've read the docs right), @IBActions and @IBOutlets for UI interaction with the code, and other things that I haven't thought of or run across yet.

    Although it seems that Swift automatically makes Cocoa initializers more Swift-like.

    Edit: I wouldn't be surprised if Apple released documentation on writing a Cocoa app in Swift in the future.
     
  18. crewkid89 macrumors regular

    crewkid89

    Joined:
    Jun 16, 2011
    Location:
    United States
    #18

    I hope so. I have no experience creating a project or designing a GUI in Xcode so some tutorials would be helpful.
     
  19. GhostRaider macrumors 6502

    Joined:
    Jun 2, 2014
    #19
    Hopefully there are authors out there that are gonna work on making a book about the Swift language for beginners. Would have been nice if Apple themselves made a beginner's guide to Swift since they're the ones that made it. Probably it will take about a year to publish something like this.
     
  20. AdonisSMU macrumors 603

    Joined:
    Oct 23, 2010
    #20
    They have a book in the ibooks store already.
     
  21. Madd the Sane macrumors 6502a

    Madd the Sane

    Joined:
    Nov 8, 2010
    Location:
    Utah
    #21
    The book is very much a low-level book on the mechanics and syntax of the language, and less on building an application. A book authored by, say, The Big Nerd Ranch would be more suited for the beginner and the novice, as opposed to someone who has studied/does study modern computer languages.
     
  22. 1458279 Suspended

    1458279

    Joined:
    May 1, 2010
    Location:
    California
    #22
    If BNR is going to do a book, which I would expect, we should see it in about 8 months or more.

    They just released the current one a few months ago. It'll be interesting to see what this does to the app store and all the app developers. They (Apple) mention they wanted Swift apps, so they could favor them over ObjC apps. Either way, this is a big change.

    Complete surprise! I have to say I've never been big on ObjC, always found it awkward. The changes are coming fast, wasn't long ago they were bragging about how popular ObjC had become, now it looks like it'll be dumped.

    There's a lot of programmers that'll have to learn yet another language :D

    I've seen this happen before and the long-term outcome was excellent, but some pain involved.
     
  23. the8thark macrumors 68040

    the8thark

    Joined:
    Apr 18, 2011
    #23
    I am sure the entire "State of the Union" keynote will the choc full of Swift talk. When it's up online to watch I'll be watching it ASAP.

    I am actually surprised MR didn't write an article up for swift. MR covered almost everything else from the Keynote. I think Swift and iOS Appstore betas were the two wow moments for me. I didn't expect them. And both of them are making me think Apple is working on the successor to OS X.
     
  24. whooleytoo macrumors 604

    whooleytoo

    Joined:
    Aug 2, 2002
    Location:
    Cork, Ireland.
    #24
    From what I've read so far, I like that switch statements can include non-constants, and even ranges! Functions returning tuples are very handy too. The for loop syntax is nice and simple.

    I do like the fact that you can just write a one-line programme. That's handy for doing quick code-snippet tests.

    I haven't read much yet that's amazingly new, but it does seem to import many of the best features of other languages.
     
  25. 960design macrumors 68030

    Joined:
    Apr 17, 2012
    Location:
    Destin, FL
    #25
    I like Swift so far, but I'm easily amused by shiny red objects, Ferrari's in particular. I'll have to get to the end of the Swift book and write a couple of apps before I can actually comment on it. So far I like the 'script-style' coding.

    Running Yosemite and XCode 6Beta and playing with playgrounds. Pretty sweet.
     

Share This Page