Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.
Its not a bad place to start, but apart from learning the language and general programming you'll also need some time and patience to learn how to build applications for iOS.



Well, yes, that's kinda why this announcement is important. Open sourcing the language is pretty much a pre-requisite for any development of server frameworks for Swift - I don't see anything fundamental in the language that would prevent it being a great server-side language except that AFAIK it is intended to compile to native binary rather than run as a script. Odds are you could already stick compiled Swift apps in cgi-bin....
Actually you can use swift as a scripting language. It was a bit convoluted to do so before, but with the latest version of Swift its like any other scripting language. Just run "swift <file to run>" and it runs it. It has a REPL that you can also access simply by running "swift" in the Terminal. So it really could compete with the likes of Python and Ruby.
 
Are they in the App Store? I'm curious what you have accomplished so far. Thx

Yea both are out! Check my signature for links.

Both started from scratch using SWIFT and the latest Xcode tools. The combination is really ultimately what lead to this quick progress.
 
You don't have to use Swift or Objective-C to publish apps on the app store (either one).

My understanding is that, at some level, you do. I'm writing my code in C# in Unity, for example, however I'm only able to do this because Unity cross compiles everything into a Obj-C++ project which Xcode then compiles and uploads to iOS or the App Store.

I suppose there is the alternative of using just HTML, CSS, and JS and feeding that all into a WebView, but even then, you had to write some minimal code in Swift or Obj-C to load those files into the WebView.
 
Swift made it idiot proof for many parts, but making it looks like a script language is beyond nasty and awful. Especially that unwrap syntax. ? and ! everywhere.
 
My understanding is that, at some level, you do. I'm writing my code in C# in Unity, for example, however I'm only able to do this because Unity cross compiles everything into a Obj-C++ project which Xcode then compiles and uploads to iOS or the App Store.

I suppose there is the alternative of using just HTML, CSS, and JS and feeding that all into a WebView, but even then, you had to write some minimal code in Swift or Obj-C to load those files into the WebView.
Swift made it idiot proof for many parts, but making it looks like a script language is beyond nasty and awful. Especially that unwrap syntax. ? and ! everywhere.

In theory ? ! to show variables that can be null is a good idea - but the mechanism leads to horrid side effects, such as:

if let nav=controller.navigationController{
nav.pushViewController(myViewController,animated:true)
}

You have to assign a variable ( if let ) to test if a variable holds a conditional variable.

Having this inside an IF statement, which is common usage just looks odd and wrong.

Swift 1 had the "pyramid of doom"....

Other aspects of Swift are good.. a mixed bag. Getting better with Swift2 - no more "pyramid of doom", and try.. catch blocks...
 
The thought, though, is that performance is good enough in 99.99% of cases. Who cares if something takes 0.00001 second vs 0.000001 seconds?

10X matters a huge amount if those tiny bits of code fill up a significant portion of some service running in a data center eating megawatts of power from a local substation. The annual power bill used by all those wasteful 0.00001 second subroutines could easily run to more than the annual salary of many dozens of more competent programmer (who could perhaps fix that waste).
 
In theory ? ! to show variables that can be null is a good idea - but the mechanism leads to horrid side effects, such as:

if let nav=controller.navigationController{
nav.pushViewController(myViewController,animated:true)
}

You have to assign a variable ( if let ) to test if a variable holds a conditional variable.

Having this inside an IF statement, which is common usage just looks odd and wrong.

Swift 1 had the "pyramid of doom"....

Other aspects of Swift are good.. a mixed bag. Getting better with Swift2 - no more "pyramid of doom", and try.. catch blocks...

If let is not the only mechanism available to handle optional types. Depending on the situation, you can use the guard syntax, optional chaining, the nil coalescing operator, and flatMap. These constructs give you a full range of methods for dealing with optional values. It is kind of the point of optionals that you have to deal with both the value and the lack of a value. I'm not sure how else this could be accomplished without checking.

And really, if let is not much worse than handling pointers to dynamically allocated memory in some other languages (C, C++). After you dynamically allocate memory and wish to use it in some way, you should check to make sure your pointer isn't null to avoid a crash. In Objective C, you should be doing:

if (!controller.navigationController) {
UINavicationController *nav = [[UINavigationController alloc] init];
}

[nav pushViewController:myViewController animated:YES];

Is that any better than binding a value with if let?
 
Wow, I'm so glad they released the Foundation APIs with it, that's going to make an open-source Swift hugely more useful out of the box.

I've used probably a dozen programming languages at various times and Swift is by far my favorite of any of them. And it's still improving as well.
 
In theory ? ! to show variables that can be null is a good idea - but the mechanism leads to horrid side effects, such as:

if let nav=controller.navigationController{
nav.pushViewController(myViewController,animated:true)
}

You have to assign a variable ( if let ) to test if a variable holds a conditional variable.

Having this inside an IF statement, which is common usage just looks odd and wrong.

Swift 1 had the "pyramid of doom"....

Other aspects of Swift are good.. a mixed bag. Getting better with Swift2 - no more "pyramid of doom", and try.. catch blocks...

Now you can do

guard nav.pushViewController(myViewController,animated:true) else { return }

before anything else , if no return, execute the rest of your code. No need for if statement or pyramid of doom.
 
if (!controller.navigationController) {
UINavicationController *nav = [[UINavigationController alloc] init];
}

[nav pushViewController:myViewController animated:YES];

Is that any better than binding a value with if let?

Yes... it is better IMO, more intuitive, and more consistent with almost every other language out there.

You are testing a variable.. for a Nil value - straight forward.

OTOH, "if let", you are testing to see if the optional can be assigned to a variable - to test for optional ( nil ). There are more elegant ways of doing this... 'if let' looks hacky and awkward - variable assignment and then testing that assignment.

Coming from other languages, it looks weird to have to do this... that is my biggest beef surrounding optional.

I'd prefer something like -
if controller.navigationController {
controller.navigationController.pushViewController(myViewController,animated:true)
}

Optional cuts down on nil variable usage, but can still have this occurring at runtime - the compiler doesn't catch some scenarios.

UPDATED -

Now you can do

guard nav.pushViewController(myViewController,animated:true) else { return }

before anything else , if no return, execute the rest of your code. No need for if statement or pyramid of doom.

Better! - thanks.
 
Last edited:
IDE vendors need to get behind Swift for other operating systems. Developers don't particularly like using a text editor for development - its slow and inefficient in most part. I wouldn't be surprised if we don't see a Swift Plugin for Eclipse ( if there isn't one already ) pretty soon... ( for Linux / Mac )

I imagine JetBrains will be the first to provide this. They already have Swift support in AppCode, which is Mac only, but it's built on the cross-platform IntelliJ IDEA platform, so I think they could quickly release a Swift-focused cross-platform IDE or a Swift plugin for IntelliJ IDEA. I'd be surprised if they haven't been preparing for this.

As for text editors, plenty of developers are happy using Emacs, Vim, Atom, Sublime, etc (though, I consider Emacs closer to an IDE than a text editor). All of those appear to have some sort of Swift support, though I don't know how good the support is.
 
I'm familiar with AppCode too - is far superior for cranking out code than Xcode - which is at best 'just acceptable'.

Jet brains have been struggling with AppCode for the past year - going down the route of adding Interface Builder support - and losing resources to CLion. Fortunately with appCode 3.2/3, they are back on track.

I imagine JetBrains will be the first to provide this. They already have Swift support in AppCode, which is Mac only, but it's built on the cross-platform IntelliJ IDEA platform, so I think they could quickly release a Swift-focused cross-platform IDE or a Swift plugin for IntelliJ IDEA. I'd be surprised if they haven't been preparing for this.

As for text editors, plenty of developers are happy using Emacs, Vim, Atom, Sublime, etc (though, I consider Emacs closer to an IDE than a text editor). All of those appear to have some sort of Swift support, though I don't know how good the support is.
 
Last edited:
  • Like
Reactions: nilk
Nothing. The first two paragraphs were about making server side applications, and how Swift would be a poor choice of language for that. I didn't mention Unity in those paragraphs.

The next paragraph was about the domain of the front end for games, where Unity is the best choice and Swift is a poor choice.

The point of my entire post was that Swift doesn't seem like a great choice for any part of any project. Obviously it's better than Obj-C, but that's setting the bar really, really low.

Umm Swift is the best choice for most iOS Apps. You can keep pushing Unity but your experience doesn't match reality for many prominent app developers. Unity's benefit lies in leveraging developers that can't/don't want to learn Swift/Objective-C. Very very few Apps, outside of games, are going to look good and function well in both iOS and Android with a pure Unity implementation.
 
Last edited:
Swift made it idiot proof for many parts, but making it looks like a script language is beyond nasty and awful. Especially that unwrap syntax. ? and ! everywhere.

Why does it look like a scripting language? Because it has strong type inference? I don't see how that's a bad thing. As for optionals, that is simply a mechanism to force programmers to deal with nil/null cases and once you know the language, the verbosity of the mechanisms becomes a smaller issue.
 
I'd recommend not digging your heels in on this issue, and reconsider. Swift results in far more stable code once you become familiar with the language and some of its new concepts (which admittedly does take some time!). You'll be thankful for taking the time do learn it in the long run!

Sounds like a sensible stance.

Any suggestions for good learning resources (paid, if necessary) for a newbie with no programming experience?
 
I'm familiar with AppCode too - is far superior for cranking out code than Xcode - which is at best 'just acceptable'.

Jet brains have been struggling with AppCode for the past year - going down the route of adding Interface Builder support - and losing resources to CLion. Fortunately with appCode 3.2/3, they are back on track.

Unfortunately, looks like they don't have immediate plans for a cross-platform AppCode/Swift IDE. From their Twitter: "Answering your question: not in the near future, but may be ) Feel free to upvote https://youtrack.jetbrains.com/issue/OC-12853 "

( https://twitter.com/appcode/status/672526311303286785 )

Personally, I'd be happy if AppCode running OS X could be used to target Linux as a deployment target. Maybe some kind of Linux workflow could be hacked together with the current version.
 
  • Like
Reactions: Stella
AWESOME. I like it so much more than objective-c. Do you think it will be expanded to more parts of the developer stack, with websites or whatever??
 
What kind of improvements are you seeing?

I just finished my first app (been working on it for a very long time), all Objective-C. I'm planning to learn Swift, but I figured I'd finish my project first. Just curious about this.

It's hard to compare coding efficiency because I'm not as proficient in Swift as Obj-C, and performance is also kind of a wash since these are mostly standard UIs with backend services (and are mostly performance limited by the network/backend).

My perspective is mainly in terms of readability, cleanliness, code flow, what I'd call "code aesthetics". I've been a developer/architect/writer for over 25 years, used/use most languages, and I definitely enjoy writing in some vs. others mostly because of the aforementioned perks of Swift (vs. Obj-C). If the resulting code is more efficient, faster, that's like icing-on-the-cake. :)
 
Swift really is amazing. The best thing about Swift though is that it's easy and understandable enough for anyone to learn!
Hopefully it inspires more people to get into programming! :)
 
My understanding is that, at some level, you do.

You don't. It would be hard to use UIKit without Objective-C or Swift, but if you don't need it (e.g., a game), you could write pretty much everything in, say, C++.

I'm writing my code in C# in Unity, for example, however I'm only able to do this because Unity cross compiles everything into a Obj-C++ project which Xcode then compiles and uploads to iOS or the App Store.

The C# code you're writing does not get translated into Objective-C. Apple briefly tried to limit languages some years ago, which would have prevented the creation of apps in Unity (which is why they temporarily looked into using C++ as a scripting language), but backed off after a big outcry.

--Eric
 
My understanding is that, at some level, you do. I'm writing my code in C# in Unity, for example, however I'm only able to do this because Unity cross compiles everything into a Obj-C++ project which Xcode then compiles and uploads to iOS or the App Store.

I suppose there is the alternative of using just HTML, CSS, and JS and feeding that all into a WebView, but even then, you had to write some minimal code in Swift or Obj-C to load those files into the WebView.

Well, the point is, you're writing your code in C#. There's a runtime in there and a platform layer that accesses the iOS APIs but that's Unity's problem, not yours.

There are similar setups for various languages.

(In fact, if you want to got the HTML/CSS/JS/WebView route, there's Cordova -- AKA Phone Gap -- that takes care of all the details and has a robust set of cross-platform plugins to access device capabilities.)

Anyway, that's all just FYI.

On the topic of Swift... We'll see. There's some cool stuff and Apple's pushing it. On the other hand, the language isn't nearly as important as the frameworks, patterns and environment supported and there, Swift is missing a lot compared to a lot of established competitors. I don't know if it's going to manage to become established outside of things Apple directly controls.
 
?

You don't have to at the moment.

Write an OSX app in Swift. OSX apps don't have to go through the MAS.




This. you don't even need to be paid up as a mac developer. Some applications I run devs never bothered to pay the small fee to get the pass from apple to install not tripping software security.

Not really a ding for them, many like me use MAS as a last resort and favor purchase/dl from the vendor. We get day 1 patch releases. No waiting for code approval from apple.

Unlock software security, allow the install, move on. Do this with trusted devs or code you know what its doing of course.
 
It doesn't have new concepts - all of the concepts are old and lifted from other functional languages. I have learned it.

It lacks frameworks for setting up servers using it, and up until now the only servers it would run on would be OS X servers. I like OS X on my development machine, but I wouldn't want hundreds of OS X servers - I'd much rather have Cent OS servers since it's more economical. So I stick with Python and the Twisted framework.

On the front end for games, I use Unity 3D. Right now, Unity 3D's best supported language is C#, so that's what I use. If they support Swift in the future and have better performance with it, I would consider switching. If a competitor to Unity 3D existed, I would consider using it (but I'm already rather invested in Unity 3D, and it's hard to say anything negative about Unity 3D).

On the front end for other projects... well, I don't have any other front end projects right now I'm working on, so I honestly haven't examined that landscape in awhile. Last I checked, I liked Python + TK a lot, but that's limited to Desktop only... I wish there was a TK for web UI...

I don't think you really understand why Swift exists. You should really read some of the things John Siracusa's section on Swift from his OSX 10.10 review (he's been talking about this for at least 10 years!) about the state of Apple's developer technologies. Basically, Swift has to be higher-level than Objective-C, while being as fast (or faster) than C, enforcing code safety while being easy to learn and fast to write.

Of course they have lifted concepts from other programming languages. Do you know anything about programming languages? They take concepts from each other all the time! That is exactly how our current suite of programming languages evolved! Even C has some heritage, you know - these things don't just pop out of the ground (well, except Brainfunk); it took concepts from ALGOL, for example (which in turn was built as an improved FORTRAN). Basically every language since C has taken concepts from C.

Swift is still only 2 years old and the focus is about getting the foundations done, but it does have some unique characteristics (such as the focus on value types). As with people, it will develop a more characteristic 'identity' as it matures.

Your point about CentOS servers are kind of relevant here: this is kind of the point behind Apple open-sourcing the language. They've provided an official Ubuntu port, and since it's open I'm sure people are working to bring it to all the rest of them as we speak.

Apple doesn't even make Mac servers any more. That means that until today the target audience for Swift programs was mostly consumer-grade hardware doing consumery-type things. Today it becomes a different animal: it's now on generic hardware doing anything you like. It has enough momentum and developers familiar with it to really compete with, say, Python in the near future.

You will see more server frameworks for Swift. It didn't make sense in a Mac-n'-iOS-only world, but now it's more interesting.
 
  • Like
Reactions: prasand
Nothing. The first two paragraphs were about making server side applications, and how Swift would be a poor choice of language for that. I didn't mention Unity in those paragraphs.

The next paragraph was about the domain of the front end for games, where Unity is the best choice and Swift is a poor choice.

The point of my entire post was that Swift doesn't seem like a great choice for any part of any project. Obviously it's better than Obj-C, but that's setting the bar really, really low.

What about non game apps? Significantly better. And then porting your app to OS X? Same code base, much better. How does that not cover the vast majority of projects an Apple dev would be doing?

For those two examples, maybe and I say maybe because I am not an expert in those areas, it is worse.

But for all intents and purposes for many many people. Swift is better.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.