or Connect
AppleInsider › Forums › Software › Mac Software › Apple's top secret Swift language grew from work to sustain Objective C, which it now aims to replace
New Posts  All Forums:Forum Nav:

Apple's top secret Swift language grew from work to sustain Objective C, which it now aims to...

post #1 of 89
Thread Starter 
Work on Swift--Apple's surprise new programming language unveiled at WWDC--started development four years ago in conjunction with efforts to keep Objective C relevant. Swift now aims to quickly replace Objective C for modern Cocoa development on iOS and OS X.

LLVM


Rather than being an entirely new "beta" idea, work on Swift started in the summer of 2010, according to the new language's originator Chris Lattner (below), who has worked at Apple since 2005. Lattner is probably best known for LLVM, the Low Level Virtual Machine compiler infrastructure project with a wyvern dragon mascot (above).

LLVM: A new compiler for Objective C



LLVM originated as Lattner's research project while a student at the University of Illinois, Urbana-Champaign in 2000. It was first publicly released as version 1.0 in 2003. In 2004, Lattner was a summer intern at Microsoft Research, where he worked on the Phoenix complier infrastructure, working to allow LLVM to compile and run .NET code.

Chris Lattner


Lattner caught the attention of Apple after posting questions about Objective-C to the company's objc-language mailing list. Apple in turn began contributing to Lattner's LLVM open source project in 2005 and subsequently hired Lattner and began funding his work.

In 2007, the LLVM project released Clang, a front end code parser for Objective C/C/C++ aimed to provide fast compiling with low memory use, expressive diagnostics, a modular library-based architecture, and tight integration within an IDE such as Apple's Xcode.

In addition to the "pure" LLVM Clang project, Lattner also proposed integrating the new LLVM, featuring its advanced code optimizer and code generator, into the existing GCC (GNU C Compiler), adding modern methods for "aggressive loop, standard scalar, and interprocedural optimizations and interprocedural analyses" missing in the standard GCC components that had long been a core element of the development tools in Unix operating systems like Apple's OS X.

GCC's support for Objective C, the primary development language of Apple's OS X Cocoa (and NeXTStep, its historical predecessor), had grown stagnant, so Apple's motivation for funding the open development of both Clang and LLVM-GCC involved keeping the Mac's Objective C relevant as a language.

Apple began aggressively using LLVM in OS X, providing LLVM-GCC to its Mac developers in order to provide access to the new LLVM compiler and benefit from its code optimizations without requiring substantial changes to their workflow based on the previous GCC.

The company also integrated LLVM into the OpenGL stack of OS X 10.5 Leopard in 2006, and leveraged LLVM to help in migrating the Mac to Intel beginning in 2005 and to the ARM architecture for the iPhone in 2007.

By the 2012 release of OS X Mountain Lion and iOS 6, Apple had moved entirely to Clang, leaving both LLVM-GCC and GCC behind. LLVM not only powers Apple's software, but is also tightly integrated into the development of Apple's custom silicon, including the A6 and A7 Application Processors.

LLVM also plays a key role in other Apple technologies, from the LLDB debugger to new APIs including Metal, Apple's new layer for high performance graphics on iOS that exposes the graphics capabilities of the newest A7 with the least possible overhead, delivering a significant performance boost over using the more general purpose OpenGL.

Swift: A new language for LLVM



By 2010, LLVM's solution to GCC's stagnant Objective C support created a new scenario where LLVM could now support more features than could be easily added to Objective C. Lattner began working on a new programming language that summer, and a year later was joined by "a few other (amazing) people."

By July 2013, Lattner noted that the new Swift project had become "major focus for the Apple Developer Tools group." It remained a secret to the public for the next year. Lattner notes in his resume that he "took over management and leadership of the entire Developer Tools department at Apple" at the beginning of 2013.

"In addition to compilers and low-level tools," Lattner notes, "I am now responsible for the Xcode IDE, Instruments performance analysis tool, Apple Java releases, and a variety of internal tools. Xcode 5 is the first result of this work, though much of the feature planning and implementation was complete before I took over. I drove convergence and defined a few key features that were released at WWDC."

Lattner noted that the new Swift language "is the product of tireless effort from a team of language experts, documentation gurus, compiler optimization ninjas, and an incredibly important internal dogfooding group who provided feedback to help refine and battle-test ideas. Of course, it also greatly benefited from the experiences hard-won by many other languages in the field, drawing ideas from Objective-C, Rust, Haskell, Ruby, Python, C#, CLU, and far too many others to list."

Apple's free iBook on Swift also notes that "Swift has been years in the making," adding that "Apple laid the foundation for Swift by advancing our existing compiler, debugger, and framework infrastructure.

"We simplified memory management with Automatic Reference Counting (ARC). Our framework stack, built on the solid base of Foundation and Cocoa, has been modernized and standardized throughout. Objective-C itself has evolved to support blocks, collection literals, and modules, enabling framework adoption of modern language technologies without disruption. Thanks to this groundwork, we can now introduce a new language for the future of Apple software development.""Swift is the first industrial-quality systems programming language that is as expressive and enjoyable as a scripting language"

The company also observes that Swift "is friendly to new programmers. It is the first industrial-quality systems programming language that is as expressive and enjoyable as a scripting language."

Apple also draws attention to the integration between Swift and LLVM, noting that the new language "combines the best in modern language thinking with wisdom from the wider Apple engineering culture. The compiler is optimized for performance, and the language is optimized for development, without compromising on either."

Swift's Interactive Playgrounds & REPL



Lattner also commented on two new features associated with Swift: Xcode's new Playgrounds (below) and REPL (Read-Eval-Print-Loop) debugging console.



"The Xcode Playgrounds feature and REPL were a personal passion of mine, to make programming more interactive and approachable," Lattner noted. "The Xcode and LLDB teams have done a phenomenal job turning crazy ideas into something truly great.

"Playgrounds were heavily influenced by Bret Victor's ideas [which are cited as a inspiration for Khan Academy's online environment for learning to program], by Light Table [an open source IDE designed to provide realtime feedback about code and how programs work] and by many other interactive systems.

"I hope that by making programming more approachable and fun, we'll appeal to the next generation of programmers and to help redefine how Computer Science is taught," Lattner stated.

Apple's presentation of Swift notes that "Playgrounds make writing Swift code incredibly simple and fun. Type a line of code and the result appears immediately. If your code runs over time, for instance through a loop, you can watch its progress in the timeline assistant. The timeline displays variables in a graph, draws each step when composing a view, and can play an animated SpriteKit scene. When you've perfected your code in the playground, simply move that code into your project."

The company states that Xcode's Playground lets users "design a new algorithm, watching its results every step of the way; create new tests, verifying they work before promoting into your test suite; experiment with new APIs to hone your Swift coding skills."

Apple notes that the REPL debugging console in Xcode "includes an interactive version of the Swift language built right in. Use Swift syntax to evaluate and interact with your running app, or write new code to see how it works in a script-like environment."

Apple says it plans to rapidly evolve Swift in response to developers needs and feature requests.

Thinkful, an education startup focused on mentor-led programming education, has already announced plans to offer a course on developing in Swift, in a program that begins July 16.
post #2 of 89
I love reading this stuff, even though I understood only three words in the entire article.
post #3 of 89

I hope Christian Laettner has a long-tenured career at Apple.  He's clearly been doing great things since leaving Duke.  Just kidding with the lame basketball reference, but guys like this will help Apple stay great.  Thanks for the interesting article.

post #4 of 89

Let’s muse:

Will Swift really be able to supplant Objective-C?

 

Also, Isn’t Peregrine a better name for it, given the icon? :p Then we could even shorten it to “P”, eventually having P++. ;) 

Originally Posted by Marvin

The only thing more insecure than Android’s OS is its userbase.
Reply

Originally Posted by Marvin

The only thing more insecure than Android’s OS is its userbase.
Reply
post #5 of 89
This might be the single most important advancement presented at this year's WWDC.
post #6 of 89
apple are so gung-ho on potential swift language development they said they cannot promise source compatibility with the language itself during the beta(though they will promise binary compatibility). Dang.
Doodle Dice iPhone puzzle game: A fun, free physics-laden collection of dice games.  Greatest app made yet?  Perhaps young man... Perhaps.
Reply
Doodle Dice iPhone puzzle game: A fun, free physics-laden collection of dice games.  Greatest app made yet?  Perhaps young man... Perhaps.
Reply
post #7 of 89
Quote:
Originally Posted by Tallest Skil View Post
 

Let’s muse:

Will Swift really be able to supplant Objective-C?

 

Also, Isn’t Peregrine a better name for it, given the icon? :p Then we could even shorten it to “P”, eventually having P++. ;) 

 

I don't know... Here's a swift.

 

and another

Disclaimer: The things I say are merely my own personal opinion and may or may not be based on facts. At certain points in any discussion, sarcasm may ensue.
Reply
Disclaimer: The things I say are merely my own personal opinion and may or may not be based on facts. At certain points in any discussion, sarcasm may ensue.
Reply
post #8 of 89
I hope no other company would snatch this guy away from Apple.
These kind of stories about great engineers and their work really inspire a lot.
post #9 of 89
Quote:
Originally Posted by macinthe408 View Post

I love reading this stuff, even though I understood only three words in the entire article.

 

I've read half way through the Reference Manual already... Lots of good stuff. I really like the removal of a lot of the baggage that came along with Objective-C in order to extend the Standard C syntax - although Apple has been hard at work at removing much of it over the passed few Xcode releases.

 

Xcode 4:  

NSArray *names = [[NSArray alloc] initWithObjects: @"Tom", @"Dick", @"Harry", nil];

 

Xcode 5:

NSArray *names = @[@"Tom", @"Dick", @"Harry"];

 

Swift:

let names = ["Tom", "Dick", "Harry"]

 

 

 

Side note: Anyone remember Dylan? Another language developed by Apple in the early 90's.


Edited by mjtomlin - 6/4/14 at 2:02pm
Disclaimer: The things I say are merely my own personal opinion and may or may not be based on facts. At certain points in any discussion, sarcasm may ensue.
Reply
Disclaimer: The things I say are merely my own personal opinion and may or may not be based on facts. At certain points in any discussion, sarcasm may ensue.
Reply
post #10 of 89
Quote:
Originally Posted by mjtomlin View Post
 

 

I've read half way through the Reference Manual already... 

I only finished a little.  I felt like ... it is scripting language and awesome. How do you guys find time? ;)

post #11 of 89
Like macinthe408 I hardly understood and love reading the article. I second adhir's comment. Advancing development with better language, better tooling and upscaling the level of abstraction to the degree that we can focus on creating something new while automating performance management is key to outperform the competition. As a developer and as company.
post #12 of 89
Quote:
Originally Posted by Tallest Skil View Post
 

Let’s muse:

Will Swift really be able to supplant Objective-C?

 

Also, Isn’t Peregrine a better name for it, given the icon? :p Then we could even shorten it to “P”, eventually having P++. ;) 

 

Have you not seen a swift in flight?

 

 

 

 

Also, "Peregrine" isn't also a pun for it being really fast.

post #13 of 89
Quote:
Originally Posted by Tallest Skil View Post

Also, Isn’t Peregrine a better name for it, given the icon?

I like the name but I recommend changing the icon to this…

"The real haunted empire?  It's the New York Times." ~SockRolid

"There is no rule that says the best phones must have the largest screen." ~RoundaboutNow

Reply

"The real haunted empire?  It's the New York Times." ~SockRolid

"There is no rule that says the best phones must have the largest screen." ~RoundaboutNow

Reply
post #14 of 89
Quote:
Originally Posted by Phone-UI-Guy View Post

Also, "Peregrine" isn't also a pun for it being really fast.

It's also too close to the word perineum. 1tongue.gif

"The real haunted empire?  It's the New York Times." ~SockRolid

"There is no rule that says the best phones must have the largest screen." ~RoundaboutNow

Reply

"The real haunted empire?  It's the New York Times." ~SockRolid

"There is no rule that says the best phones must have the largest screen." ~RoundaboutNow

Reply
post #15 of 89
Quote:
Originally Posted by mjtomlin View Post

I've read half way through the Reference Manual already... Lots of good stuff. I really like the removal of a lot of the baggage that came along with Objective-C in order to extend the Standard C syntax - although Apple has been hard at work at removing much of it over the passed few Xcode releases.

Xcode 4:  
NSArray *names = [[NSArray alloc] initWithObjects: @"Tom", @"Dick", @"Harry", nil];

Xcode 5:
NSArray *names = @[@"Tom", @"Dick", @"Harry"];

Swift:
let names = ["Tom", "Dick", "Harry"]



Side note: Anyone remember Dylan? Another language developed by Apple in the early 90's.

I'm pretty sure the Xcode 4 example you have compiles in NeXT Project Builder circa 1989. It's about damn time Apple moved Mac OS X programming into the 2010s.

"Apple should pull the plug on the iPhone."

John C. Dvorak, 2007
Reply

"Apple should pull the plug on the iPhone."

John C. Dvorak, 2007
Reply
post #16 of 89

I have no technical reason for stating this because I am no programmer. I can hold my on with some HTML and some scripts but when it comes to C and other languages I am lost. What I want to say is based strictly off a gut feeling, but I think Swift might not only be the biggest news this WWDC but possibly in many years. From what I can gather this is a leaner, meaner, more modern language that could allow an entire new generation and pool of talent that were scared to death of Objective C as being too difficult to even attempt to learn. All those people fluent in other languages shouldn't have many problems transitioning and learning Swift. It also seems a lot of the knowledge acquired with Objective C can be used with Swift.  So far it seems like Swift is a much less daunting language to learn. WWDC is sort of like the cement conference where they pour the foundation. In the fall the iPhone 6 and hopefully several other new products will be the skyscraper.

post #17 of 89
Originally Posted by mjtomlin View Post

I don't know... Heres a swiftand another

Originally Posted by Phone-UI-Guy View Post

Have you not seen a swift in flight? Also, "Peregrine" isn't also a pun for it being really fast.

 

Good points. Shame they couldn’t call it Swallow, though. Then OS 10.11 Capistrano would have been all the more fitting.

 

Originally Posted by SolipsismX View Post
It's also too close to the word perineum. 1tongue.gif

 

That joke nearly gave me peritonitis. 

Originally Posted by Marvin

The only thing more insecure than Android’s OS is its userbase.
Reply

Originally Posted by Marvin

The only thing more insecure than Android’s OS is its userbase.
Reply
post #18 of 89
Quote:
Originally Posted by gwmac View Post

I have no technical reason for stating this because I am no programmer. I can hold my on with some HTML and some scripts but when it comes to C and other languages I am lost. What I want to say is based strictly off a gut feeling, but I think Swift might not only be the biggest news this WWDC but possibly in many years. From what I can gather this is a leaner, meaner, more modern language that could allow an entire new generation and pool of talent that were scared to death of Objective C as being too difficult to even attempt to learn. All those people fluent in other languages shouldn't have many problems transitioning and learning Swift. It also seems a lot of the knowledge acquired with Objective C can be used with Swift.  So far it seems like Swift is a much less daunting language to learn. WWDC is sort of like the cement conference where they pour the foundation. In the fall the iPhone 6 and hopefully several other new products will be the skyscraper.

I'm finding it insanely easier to learn. All that redundant looking code is just gone in Swift. So far I'm plugging through about the 5% of the eBook per day testing example. I hope to be able to incorporate it into proper apps within the month.

"The real haunted empire?  It's the New York Times." ~SockRolid

"There is no rule that says the best phones must have the largest screen." ~RoundaboutNow

Reply

"The real haunted empire?  It's the New York Times." ~SockRolid

"There is no rule that says the best phones must have the largest screen." ~RoundaboutNow

Reply
post #19 of 89
I want to love Swift, but at this stage I just can't, not in its current state. I've only gotten through about the first 200 pages of the iBook but there are things that, IMO, could/should be more rationalized, particularly some of the syntax. A couple things off the top of my head:

Variables are declared: var foo: Int
That's fair enough, but then 'optionals' are declared: var foo:Int?
That's too little of a difference (ok, I'm used to C's * for pointers and that's only a single character so...). Anyhow, so I want to use my optional, it's easy in a boolean context to determine if it has a value:

if foo {...

but in a scalar context I have to refer to it:

bar = foo!

or decompose it in the boolean context:

if var bar = foo {
// do something with bar

But, that's not all. I could actually declare it:

var foo: Int!

What does that buy me? The ability to refer to it in a scalar context directly:

bar = foo

In the boolean context it's still interpreted as 'does it have a value' thus the context is clearly known in interpreting it. So, why two different ways to specify it and use it?

In light of the contextual interpretation, I could argue that having all variables be 'optionals' by default would be a more natural and consistent approach. The compiler can certainly warn you if you're attempting to use it before assigning it a value and even if you ignore that warning it's a runtime fault to use it if it doesn't have a value. With 'optional' as the default (only?) type, all variables could be used in the exact same way; e.g.

var foo: Int
...
if foo {
// do something with foo
} else {
// foo has no value
}

Second, the inconsistency between:

let array = [a, b, c]
let dictionary = [d : 1, e : 2]

According to the documentation this creates, respectively, an immutable array and dictionary, except the dictionary is truly immutable and arrays are only sort-of immutable.
While the dictionary cannot be changed at all and the array can't change size, the contents of the array can be changed. That's hardly immutable and certainly different from the true immutability of NSArray.

That's probably enough for now for you all to take me to task. :-)
I'd love something more modern than Objective-C, something where everything is an object, say. Or any number of other things, but as it stands, I don't think Swift is it.
post #20 of 89
Quote:
Originally Posted by gwmac View Post
 

I have no technical reason for stating this because I am no programmer. I can hold my on with some HTML and some scripts but when it comes to C and other languages I am lost. What I want to say is based strictly off a gut feeling, but I think Swift might not only be the biggest news this WWDC but possibly in many years. From what I can gather this is a leaner, meaner, more modern language that could allow an entire new generation and pool of talent that were scared to death of Objective C as being too difficult to even attempt to learn. All those people fluent in other languages shouldn't have many problems transitioning and learning Swift. It also seems a lot of the knowledge acquired with Objective C can be used with Swift.  So far it seems like Swift is a much less daunting language to learn. WWDC is sort of like the cement conference where they pour the foundation. In the fall the iPhone 6 and hopefully several other new products will be the skyscraper.

 

I think Swift is a sign that they're getting as serious about the developer toolchain as they are about consumer software. It's very interesting that Lattner has taken over the Developer Tools team. It fits the Apple model of having a "personality" at the top. I think it's very, very important when you look at it from a big picture perspective: Apple is going to be really pushing innovation in developer tools from now on. I think the important thing with Swift is that it will appeal to web developers, who will find it more familiar than the rather esoteric Objective-C. With this language, the changes to the App Store and CloudKit, we could see a big exodus of developers from the web to apps.

 

What's really interesting to think about is that Apple probably has more data on programming bugs and performance than anyone on Earth, since it reviews every app that goes in the App Store, and must surely be using that data to drive the design of Swift. So what we have here might be the first truly empirically motivated programming language. From what I've seen briefly viewing the language, the focus is on safety, performance and concision, so this seems to be the case.

post #21 of 89
post #22 of 89
The article is pretty much Greek to me from a technical standpoint, but it is obvious that the incredible Apple team is going to continue to make this company even greater!
post #23 of 89
Quote:
Originally Posted by Rogifan View Post

Of course ZDNET aka Microsoft's PR arm, pisses all over Swift. 1rolleyes.gif

http://www.zdnet.com/apples-new-swift-development-language-highlights-the-companys-worst-side-7000030150/

 

That's a relief!

 

If ZDNET hadn't gone into panic mode on Microsoft's behalf then I might have been worried.

post #24 of 89
Quote:
Originally Posted by gwmac View Post
 

I have no technical reason for stating this because I am no programmer. I can hold my on with some HTML and some scripts but when it comes to C and other languages I am lost. What I want to say is based strictly off a gut feeling, but I think Swift might not only be the biggest news this WWDC but possibly in many years. From what I can gather this is a leaner, meaner, more modern language that could allow an entire new generation and pool of talent that were scared to death of Objective C as being too difficult to even attempt to learn. All those people fluent in other languages shouldn't have many problems transitioning and learning Swift. It also seems a lot of the knowledge acquired with Objective C can be used with Swift.  So far it seems like Swift is a much less daunting language to learn. WWDC is sort of like the cement conference where they pour the foundation. In the fall the iPhone 6 and hopefully several other new products will be the skyscraper.

 

I've done a lot of development over the last twenty years. Started out with C then C++ then Java, Ruby and now getting to grips with Python.

 

I've avoided ObjectiveC because, quite frankly, I just didn't like the look of it. I've seen amazing things done with it and I'm happy to admit that I was being very narrow-minded, but with such great things happening in IT, I just couldn't see the point of learning something that looked like C in a pretty dress. I went through the Swift manual in one night (yes, I stayed up all night to read it). 

No, it's nothing new in terms of language design, but it's something new on the fastest growing, most cohesive ecosystem out there. 

 

The language is fast, buzzword-compliant and is backed by an cloud application platform (think Google app engine). This is the beginning of a massive assault on the enterprise market.

post #25 of 89
Originally Posted by Tallest Skil View Post

Let’s muse:

Will Swift really be able to supplant Objective-C?

Given that the AppStore launched in 2008, and I'd have to surmise that the vast majority of submissions are from people who never looked at Obj-C before that point, that implies Apple convinced thousands (millions?) of people to pick up Obj-C in the last five years.

 

So why shouldn't they convince them to switch to something that's supposedly much better? MS did with C#.

post #26 of 89
Originally Posted by Maury Markowitz View Post

MS did with C#.

 

They use some F#, too, don’t they?

Originally Posted by Marvin

The only thing more insecure than Android’s OS is its userbase.
Reply

Originally Posted by Marvin

The only thing more insecure than Android’s OS is its userbase.
Reply
post #27 of 89
Quote:
Originally Posted by Maury Markowitz View Post

Given that the AppStore launched in 2008, and I'd have to surmise that the vast majority of submissions are from people who never looked at Obj-C before that point, that implies Apple convinced thousands (millions?) of people to pick up Obj-C in the last five years.

So why shouldn't they convince them to switch to something that's supposedly much better? MS did with C#.

And it's much easier 1) to learn, 2) to type (since it's less complex code structures and typically much shorter in length), 3) to read (for the reasons give for "to type"), 4) to see an error as you're typing it, and 5) to comprehend where and why your code is changing at any given point. Including with those points is the lack of header files.

My comprehension of Obj-C is low and believe you me I've been trying to become proficient for years, but I'm picking up Swift quickly.

"The real haunted empire?  It's the New York Times." ~SockRolid

"There is no rule that says the best phones must have the largest screen." ~RoundaboutNow

Reply

"The real haunted empire?  It's the New York Times." ~SockRolid

"There is no rule that says the best phones must have the largest screen." ~RoundaboutNow

Reply
post #28 of 89
Originally Posted by SolipsismX View Post
And it's much easier 1) to learn, 2) to type (since it's less complex code structures and typically much shorter in length), 3) to read (for the reasons give for "to type"), 4) to see an error as you're typing it, and 5) to comprehend where and why your code is changing at any given point. Including with those points is the lack of header files.

My comprehension of Obj-C is low and believe you me I've been trying to become proficient for years, but I'm picking up Swift quickly.

Agree completely. With a few exceptions - "let", "->" and why oh god are there "@'s" in this language - I found it totally easy to grasp.

 

If there were users that were turned off iOS/MacOS because of Obj-C, maybe this will grab them too. For those who haven't used it, this strikes me as all good.

 

BTW, did you come across a way to call C code from Swift? I have whole libraries of C that do math, am I up the creek?

post #29 of 89
Quote:
Originally Posted by SolipsismX View Post


And it's much easier 1) to learn, 2) to type (since it's less complex code structures and typically much shorter in length), 3) to read (for the reasons give for "to type"), 4) to see an error as you're typing it, and 5) to comprehend where and why your code is changing at any given point. Including with those points is the lack of header files.

My comprehension of Obj-C is low and believe you me I've been trying to become proficient for years, but I'm picking up Swift swiftly.

 

;)

Proud AAPL stock owner.

 

GOA

Reply

Proud AAPL stock owner.

 

GOA

Reply
post #30 of 89
Quote:
Originally Posted by Chandra69 View Post

I only finished a little.  I felt like ... it is scripting language and awesome.
I think I've managed to read a dozen or so pages and I have to agree it has a nice feel to it.
Quote:
How do you guys find time? 1wink.gif

Obviously I haven't if the manual is yet to be read. Maybe a little less time on AI, Reddit and so forth.

In any event I see some initial possibilities that will make this platform great if they come to pass:
  1. Apple submits the language to a standards body so that wider adoption can happen!
  2. The way this works within XCode would make it an excellent platform for use as a scripting language within apps. In fact if I was Apple this would be a high priority for iWork.
  3. I have a feeling this could crush Python if it gets widely adopted. I really hope that Apple is hard at work porting libraries to the platform and doesn't forget about non GUI apps. So I'm hoping that Apple has goals to develop a large standard library in the same way many scripting languages have such libraries. It would be even better if Apple supports the language with a repository of modules that are open sourced.
post #31 of 89
Quote:
Originally Posted by Maury Markowitz View Post
 

Agree completely. With a few exceptions - "let", "->" and why oh god are there "@'s" in this language - I found it totally easy to grasp.

 

If there were users that were turned off iOS/MacOS because of Obj-C, maybe this will grab them too. For those who haven't used it, this strikes me as all good.

 

BTW, did you come across a way to call C code from Swift? I have whole libraries of C that do math, am I up the creek?

 

Just chiming in here, but I thought the beauty of Swift was that it will accept C in addition to Swift code. Am I wrong?

Proud AAPL stock owner.

 

GOA

Reply

Proud AAPL stock owner.

 

GOA

Reply
post #32 of 89
Objective C isn't much more than an enhanced C as a language. What people had to spend a lot of time on was learning the APIs which are extensive.
Quote:
Originally Posted by Maury Markowitz View Post

Given that the AppStore launched in 2008, and I'd have to surmise that the vast majority of submissions are from people who never looked at Obj-C before that point, that implies Apple convinced thousands (millions?) of people to pick up Obj-C in the last five years.

So why shouldn't they convince them to switch to something that's supposedly much better? MS did with C#.

The big problem here is that this is a bigger departure from C/Objective C and as yet they haven't indicated any desire to public ally standardize it. I suspect many developers would be happier if they had some assurance that Swift will grow outside if Apple.
post #33 of 89
Quote:
Originally Posted by Maury Markowitz View Post

Agree completely. With a few exceptions - "let", "->" and why oh god are there "@'s" in this language - I found it totally easy to grasp.

If there were users that were turned off iOS/MacOS because of Obj-C, maybe this will grab them too. For those who haven't used it, this strikes me as all good.

BTW, did you come across a way to call C code from Swift? I have whole libraries of C that do math, am I up the creek?

So the Swift Playground is just for Swift but the noted use of NSLog means that some C-based code is allowed on some limited, preconfigured basis. There is no direct import option but I'd imagine if you also have a great deal of C code you would just make a typical app where you could still use Swift alongside C and Obj-C. Right?

"The real haunted empire?  It's the New York Times." ~SockRolid

"There is no rule that says the best phones must have the largest screen." ~RoundaboutNow

Reply

"The real haunted empire?  It's the New York Times." ~SockRolid

"There is no rule that says the best phones must have the largest screen." ~RoundaboutNow

Reply
post #34 of 89
For Python fans, I can see quite a bit in there...
http://www.LearnSwift.tips/
Heads up hackers - may be that scripting is supported.
post #35 of 89
Quote:
Originally Posted by SpamSandwich View Post

Just chiming in here, but I thought the beauty of Swift was that it will accept C in addition to Swift code. Am I wrong?

I heard it as Swift, the language, is free of archaic C-based commands (mostly) but has the performance of C, and you can write apps that incorporate C, Obj-C and Swift in any manner as you see fit because the compiler is fully compatible.

"The real haunted empire?  It's the New York Times." ~SockRolid

"There is no rule that says the best phones must have the largest screen." ~RoundaboutNow

Reply

"The real haunted empire?  It's the New York Times." ~SockRolid

"There is no rule that says the best phones must have the largest screen." ~RoundaboutNow

Reply
post #36 of 89
Quote:
Originally Posted by Ripper View Post

That's probably enough for now for you all to take me to task. :-)
I'd love something more modern than Objective-C, something where everything is an object, say. Or any number of other things, but as it stands, I don't think Swift is it.

Ok you have been working with Swift for 24 hours. Lattner has been working with it since 2010 and working on the building blocks for 15 years. He also probably has an IQ of 200. He says it can replace Obj-C and by extension most likely C, C++, C#. He has a whole team of geniuses working together on this. I'd take his word over anyone else especially someone who has only one day under their belt.

Life is too short to drink bad coffee.

Reply

Life is too short to drink bad coffee.

Reply
post #37 of 89
Quote:
Originally Posted by gwmac View Post

I have no technical reason for stating this because I am no programmer. I can hold my on with some HTML and some scripts but when it comes to C and other languages I am lost. What I want to say is based strictly off a gut feeling, but I think Swift might not only be the biggest news this WWDC but possibly in many years. From what I can gather this is a leaner, meaner, more modern language that could allow an entire new generation and pool of talent that were scared to death of Objective C as being too difficult to even attempt to learn. All those people fluent in other languages shouldn't have many problems transitioning and learning Swift. It also seems a lot of the knowledge acquired with Objective C can be used with Swift.  So far it seems like Swift is a much less daunting language to learn.

A lot of modern development is based around web programming and the iPhone was originally going to be web apps only. It needed performance and access to graphics frameworks though and C-based languages are the most popular but they are no good for rapid application development and that's what's needed these days. Turnaround times are more important than raw performance for most apps. For the ones that need the performance, they can do it the way they know how. Swift offers both performance and fast turnaround times.

It could even replace Applescript (hopefully).

It would be nice if they'd open source it and make moves for it to compete with C#. If it was in 3rd party SDKs like Unity, they can natively compile apps without XCode and could more easily call iOS system APIs. That might mean people don't bother buying Macs for iOS development, although the simulator would still be Mac-only and wide support and adoption of the language would be beneficial.
Quote:
Originally Posted by Maury Markowitz 
Given that the AppStore launched in 2008, and I'd have to surmise that the vast majority of submissions are from people who never looked at Obj-C before that point, that implies Apple convinced thousands (millions?) of people to pick up Obj-C in the last five years.

I doubt that's the case. A lot of apps are very simple apps, they need to be turned around quickly and deployed to more than iOS. 3rd party SDKs are used a fair bit and many simply use web languages:

http://www.sencha.com
https://xamarin.com
http://www.appcelerator.com
http://phonegap.com
https://www.unrealengine.com
http://unity3d.com
http://coronalabs.com/products/corona-sdk/

An exception is the following used for Badland, which uses Objective-C:

http://www.cocos2d-iphone.org

The next step (pun intended) would be to allow Swift development on iOS itself. In fact, only Swift development and not C/C++/Objective-C. People can build their sprites in some drawing app, use the app extensions to bring them in to XCode for iOS and run it in real-time. That should make Alan Kay happy.
post #38 of 89
Quote:
Originally Posted by SolipsismX View Post


I heard it as Swift, the language, is free of archaic C-based commands (mostly) but has the performance of C, and you can write apps that incorporate C, Obj-C and Swift in any manner as you see fit because the compiler is fully compatible.

 

It doesn't have the performance of C or Lattner and Federighi would have put up the sorting and other graphs to show it. It doesn't have the added overhead of ObjC 2.0 [they've put the magic into the compiler] but it sure won't match C11/C99.

 

The Python comparison was obnoxious.

post #39 of 89
"LLVM not only powers Apple's software, but is also tightly integrated into the development of Apple's custom silicon, including the A6 and A7 Application Processors."

And there we have the proof that Apple with put A chips in their Macs.
post #40 of 89
Quote:
Originally Posted by wizard69 View Post

Objective C isn't much more than an enhanced C as a language. What people had to spend a lot of time on was learning the APIs which are extensive.
The big problem here is that this is a bigger departure from C/Objective C and as yet they haven't indicated any desire to public ally standardize it. I suspect many developers would be happier if they had some assurance that Swift will grow outside if Apple.

 

My 17th thought (after a bunch of ooohs and ahhhhs) was that I could see most of it implemented on top of a JVM.

It is useless for sheep to pass laws outlawing carnivorism when the wolf is of a different mind.
Reply
It is useless for sheep to pass laws outlawing carnivorism when the wolf is of a different mind.
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Mac Software
AppleInsider › Forums › Software › Mac Software › Apple's top secret Swift language grew from work to sustain Objective C, which it now aims to replace