Swift programming language - Apple Keynote

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
objective-c has served us so well for 20 years we absolutely love it but we had to ask ourselves the question what would it be like if we had objective-c without the baggage of C we did more than think about it we have a new programming language the language is called Swift and it totally rules Swift is fast it is modern it is designed for safety and it enables a level of interactivity and development that you've never seen on the platform when it comes to speed Swift is great compare Python a popular scripting language with objective-c when it comes to something like let's say complex object sort Objective C is a lot faster but Swift is faster still and take something like rc4 encryption extremely computationally intensive Python gets utterly crushed in this particular benchmark and objective but look at Swift now Swift is also modern with features like closures generics type inference multiple return types and namespaces you know many people at home are going what in the heck are these guys talking about with Swift you're able to reduce a common pattern that you might see in your Objective C code like this and reduce it to something as simple as this and Swift defines away large classes of common programming errors they just aren't possible now Swift is completely native to cocoa and cocoa touch it's built with the same LLVM compiler as Objective C using the same optimizer and Auto vectorizer and it has the same arc memory management model and the same runtime which means that your Swift code can fit right alongside your objective-c and your C code in the same application now Swift also enables a level of dynamism and interactivity and development that we've never seen before with a feature we call playgrounds to demonstrate Swift and playgrounds in action I'd like to bring to the stage Chris Lattner come on up Chris Thank You Craig I am thrilled to be here and to be the first person to give you a taste of Swift let me show you how fun and interactive it is to write swift code this is a swift playground as I start typing I get an immediate response it is actually running my code as I type it and displaying the result in the sidebar to the right of course Swift uses type inference and has powerful string processing capabilities which make it as easy to use as a scripting language without sacrificing any performance Swift was designed from the ground up for cocoa and cocoa touch so of course I have their full power at my fingertips now I can build anything with Swift from a social media application all the way up to a high-performance 3d game using metal but today to keep it simple I think I'll write a simple casual 2-d game let's start by using NS image let's start by using an SMS to load a resource as you can see here I've the playground season I've loaded an image I can even see it right here from within Xcode now Swift is loaded with high-end features like generics that allow me to get a lot done with very little code here you can see I'm using an array of strings and using the functional map algorithm to apply a closure to every element which allows me to load an entire list of images all with a simple line of code now all these resources are part of this game that I'm working on and one piece of them only to finish up is the flight path for the blimp that we have now this is a simple loop that computes the position for the blimp over time as my game plays and in addition to seeing individual values Swift playgrounds even allow me to visualize the entire history of a value over time as my application runs and so now I can immediately see that this equation will cause my blimp to slowly sink as the scene plays out but I think I can do better and that's not exactly what I'm looking for so I can change the code and I get an immediate response simply by changing the equation the blimp will now rise and fall as the scene plays out which is a lot more of what I'm looking for so now that we have this the way we want we can take this and copy it let's go to the game that I'm working on it's right here now this is a playground just like before but here I have a game in the code written using sprite kit now you can see our blimp going left and right straight across the scene and I can try out the flight path that we just developed simply by pasting it in and getting the immediate feedback I'm looking for now the blimp is rising and falling just like I want it because Swift enables such powerful interactive and dynamic programming experiences it makes it really easy to try out new things and just by adding a few lines of code I can enable sprite kids per-pixel collisions field forces and lighting effects getting a much more interesting result now Swift playgrounds even give you full power over time and with this timeline at the bottom of the screen I can go forwards and backwards through the execution of my game so I can really see those effects in action I can see the balloons interacting with each other and with the blimp just like that playgrounds give me unprecedented power to see my app in detail and give me full control when I want to refine and polish my application but of course so works great with Xcode and runs great on iOS so let's now jump and see what the finished product looks like here we go and this is the game we just built looks pretty great now as Craig told you earlier we've also brought scene kit to iOS with sync it it's super easy to build it a 3d version of our game and that's just a quick taste and quick look at Swift I think you guys are going to absolutely love it so that's Swift it gives you access to all of cocoa and cocoa touch so you can build everything from a simple example like you saw there Chris to the most powerful applications you can imagine and Swift is going to be ready for primetime out of the gates it comes with complete Xcode support with indexing code completion and debugging and there's a swift language guide available to you now in iBooks along with complete reference documentation and when iOS and OS 10 are available day one you can submit apps written and Swift to the App Store that is Swift
Info
Channel: Serg Ramírez
Views: 268,714
Rating: 4.8657036 out of 5
Keywords: Swift, Programming Language (Literary Genre), Test, App, Game, Apple
Id: f7dD75rPZH4
Channel Id: undefined
Length: 8min 37sec (517 seconds)
Published: Mon Jun 02 2014
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.