Make swiftly iOS development Telerik Academy Telerik Academy Plus.

Slides:



Advertisements
Similar presentations
Windows Basic and Dynamic Disk Borislav Varadinov Telerik Software Academy academy.telerik.com System Administrator Marian Marinov CEO of 1H Ltd.
Advertisements

Hybrid or Native?! Doncho Minkov Telerik Software Academy Senior Technical Trainer
HTML Forms, GET, POST Methods Tran Anh Tuan Edit from Telerik Academy
Amazon S 3, App Engine Blobstore, Google Cloud Storage, Azure Blobs Svetlin Nakov Telerik Software Academy academy.telerik.com.
Queues, Notifications, , CDN, Logging, Caching, Background Tasks, MapReduce, … Svetlin Nakov Telerik Software Academy academy.telerik.com.
RPN and Shunting-yard algorithm Ivaylo Kenov Telerik Software Academy academy.telerik.com Technical Assistant
Shortest paths in edge-weighted digraph Krasin Georgiev Technical University of Sofia g.krasin at gmail com Assistant Professor.
Telerik Software Academy Telerik School Academy.
Coding JavaScript the expressive way Learning & Development Telerik Software Academy.
Asynchronous Programming with C# and WinRT
Unleash the Power of JavaScript Tooling Telerik Software Academy End-to-end JavaScript Applications.
Touch and Gestures with Xamarin Forms
Character sequences, C-strings and the C++ String class, Working with Strings Learning & Development Team Telerik Software Academy.
Hybrid or Native?! Doncho Minkov Telerik Software Academy Senior Technical Trainer
Done already for your convenience! Telerik School Academy Unity 2D Game Development.
Processing Sequences of Elements Telerik School Academy C# Fundamentals – Part 1.
With Mocha and Karma Telerik Academy Telerik Software Academy.
C# Fundamentals – Part I
Welcome to the JSON-stores world Telerik Software Academy Databases.
The Business Plan and the Business Model Margarita Antonova Volunteer Telerik Academy academy.telerik.com Business System Analyst Telerik Corporation.
What are ADTs, STL Intro, vector, list, queue, stack Learning & Development Team Telerik Software Academy.
Making JavaScript code by template! Learning & Development Team Telerik Software Academy.
Svetlin Nakov Telerik Software Academy academy.telerik.com Manager Technical Training Who, What, Why?
Installation, Data types, Control flow structures, Loops, Functions, Strings, OOP, Data Structures, Tuples, Destructuring Assignments Telerik Academy Plus.
Access to known folders, using pickers, writing to and reading from files, caching files for future access George Georgiev Telerik Software Academy academy.telerik.com.
Processing Matrices and Multidimensional Tables Svetlin Nakov Telerik Software Academy academy.telerik.com Technical Trainer
Learning & Development Telerik Software Academy.
Reading and Writing Text Files Svetlin Nakov Telerik Software Academy academy.telerik.com Technical Trainer
Telerik Software Academy ASP.NET Web Forms.
Classical OOP in JavaScript Classes and stuff Telerik Software Academy
Optimization problems, Greedy Algorithms, Optimal Substructure and Greedy choice Learning & Development Team Telerik Software.
Using Selenium for Mobile Web Testing Powered by KendoUI Telerik QA Academy Atanas Georgiev Senior QA Engineer KendoUI Team.
New features: classes, generators, iterators, etc. Telerik Academy Plus JavaScript.Next.
Throwing and Catching Exceptions Tran Anh Tuan Edit from Telerik Software Academy
Loops, Conditional Statements, Functions Tran Anh Tuan Edit from Telerik Academy
Private/Public fields, Module, Revealing Module Learning & Development Team Telerik Software Academy.
Building Data-Driven ASP.NET Web Forms Apps Telerik Software Academy ASP.NET Web Forms.
Course Introduction Svetlin Nakov Telerik Software Academy academy.telerik.com Manager Technical Training
Telerik Software Academy End-to-end JavaScript Applications.
Planning and Tracking Software Quality Yordan Dimitrov Telerik Corporation Team Leader, Team Pulse, Team Leader, Team Pulse, Telerik Corporation,
What you need to know Ivaylo Kenov Telerik Corporation Telerik Academy Student.
Data binding concepts, Bindings in WinJS George Georgiev Telerik Software Academy academy.telerik.com Technical Trainer itgeorge.net.
Pavel Kolev Telerik Software Academy Senior.Net Developer and Trainer
Objects, Properties, Primitive and Reference Types Learning & Development Team Telerik Software Academy.
When and How to Refactor? Refactoring Patterns Alexander Vakrilov Telerik Corporation Senior Developer and Team Leader.
Free Training and Job for Software Engineers Svetlin Nakov, PhD Manager Technical Training Telerik Corp. Telerik Software Academy.
Free Training and Job for Software Engineers Svetlin Nakov, PhD Manager Technical Training Telerik Corp. Telerik Software Academy.
Access to known folders, using pickers, writing to and reading from files, caching files for future access George Georgiev Telerik Software Academy academy.telerik.com.
Doing the Canvas the "easy way"! Learning & Development Telerik Software Academy.
Creating and Running Your First C# Program Svetlin Nakov Telerik Software Academy academy.telerik.com Manager Technical Training
Course Overview Doncho Minkov Telerik Software Academy Technical Trainer
Subroutines in Computer Programming Telerik School Academy C# Fundamentals – Part 1.
Data Types, Primitive Types in C++, Variables – Declaration, Initialization, Scope Telerik Software Academy academy.telerik.com Learning and Development.
The past, the present, the future Learning & Development Team Telerik Software Academy.
Learn to Design Error Steady Code Svetlin Nakov Telerik Software Academy academy.telerik.com Technical Trainer
Connecting, Queries, Best Practices Tran Anh Tuan Edit from Telerik Software Academy
Processing Sequences of Elements Telerik Software Academy C# Fundamentals – Part 2.
Telerik JavaScript Framework Telerik Software Academy Hybrid Mobile Applications.
Telerik Software Academy Databases.
Things start to get serious Telerik Software Academy JavaScript OOP.
Learning & Development Mobile apps for iPhone & iPad.
Processing Matrices and Multidimensional Tables Telerik Software Academy C# Fundamentals – Part 2.
Nikolay Kostov Telerik Software Academy academy.telerik.com Team Lead, Senior Developer and Trainer
Functions and Function Expressions Closures, Function Scope, Nested Functions Telerik Software Academy
Implementing Control Logic in C# Svetlin Nakov Telerik Software Academy academy.telerik.com Manager Technical trainer
Inheritance, Abstraction, Encapsulation, Polymorphism Telerik Software Academy Mobile apps for iPhone & iPad.
Mocking tools for easier unit testing Telerik Software Academy High Quality Code.
What why and how? Telerik School Academy Unity 2D Game Development.
Windows Security Model Borislav Varadinov Telerik Software Academy academy.telerik.com System Administrator
Definition, Constructors, Methods, Access Modifiers, Static/Instance members, Learning & Development Team Telerik Software Academy.
Presentation transcript:

Make swiftly iOS development Telerik Academy Telerik Academy Plus

 Doncho Minkov  Senior Technical Telerik Software Academy  Contestant in the Informatics competitions  Experience with Web and Mobile apps  Proficient with JavaScript and.NET  doncho.minkov [at] telerik.com  Blog:

 Swift overview  Language syntax and specifics  Variables, structures and optional values  Control structures: if-else, switch, loops  Functions as first-class objects, closures, etc…  OOP: classes, protocols, enums, extensions  Syntactic sugar: destructuring assignments  iOS applications with Swift  Handling gestures on the UI  Using graphics and animations

What and Why?

 Swift is an innovative new programming language for Cocoa and Cocoa Touch  Writing code is interactive and fun  The syntax is concise yet expressive  Apps run lightning-fast  Swift can be used for creating brand-new iOS and OS X apps  Or to add features to applications written with Objective-C

 Swift was introduced at WWDC 2014 as the "new way to create apps for iPhone and iPad"  Objective-C without the C  Descendant to Objective-C  No pointers  Functions as first-class objects  Influenced from many modern languages:  JavaScript, Objective-C, C#, Python, Scala, etc…

 Since Swift is pretty new and still needs exploring Apple has provided ways to experiment the new features:  REPL (Read Eval Print Loop)  Run swift code from the Terminal  Xcode interactive Playground  Immediate code evaluation, while typing

 To use the REPL of Swift follow the steps: 1.Start Terminal.app 2.Type 3.Type code directly inside the Terminal 4.The output is shown directly on the Terminal  You can also execute code from a swift file: $ swift $ swift print-primes.swift

Live Demo

 Apple has provided a Playground for experimenting with Swift features inside Xcode  Write code and receive immediate result  Great for exploring Swift features and research  Allows fast testing of features and syntax

Live Demo

Laying the groundwork

 Swift syntax:  Variables and contants  Control structures  If-else, loops, switch  Data structures  Arrays, dictionaries, sets  Classes and structures  Init functions, methods, properties, fields  OOP  Protocols, extensions, inheritance

var and let, primitive and reference, functions

 Swift supports the common data types, coming from Objective-C  Int for creating integers numbers  UInt for creating unsigned integer numbers  Float, Double for floating-point numbers  Bool for Boolean values  [] for array, [Int] for array of integers  Swift supports both structures and classes  Structures create primitive types  Classes create reference types

 Swift provides two keywords for creating variables:  let and var  var creates a mutable variable  Its value can be changed any time  The type can be provided or inferred  let creates immutable variable  If the type is struct, its value cannot be changed  If the type is object, it can be changed only internally

 Creating a variable of type integer:  Using let let numberOfCourses: Int = 15 numberOfCourses = 16 // compiler error  Using var var count :Int = 15 count++ //this is Ok  Variable types are inferred  The compiler will understand that you want Int  Works with let and var let numberOfCourses = 15 var count = 15

Live Demo

 Functions in Swift have the following syntax:  Function returning void: func printMessage(message: String) { println(String(format: "Message: message)) println(String(format: "Message: message))}  Function returning integer: func sum(x: Int, y: Int) -> Int { return x + y return x + y}  Function with parameters put inside an array: func sum(numbers: Int…) -> Int { var sum = 0 var sum = 0 for number in numbers { sum += number} for number in numbers { sum += number} return sum return sum}

Live Demo

 Swift supports the standard control flow structures: if condition { //run code //run code} else if condition2 { //run other code //run other code} else { //run third code //run third code} switch language { case "Objective-C", "Swift": println("iOS") println("iOS") case "Java": println("Android") println("Android") case "C#": println("Windows Phone") println("Windows Phone")default: println("Another platform") println("Another platform")} switchif-else

Live Demo

 Swift supports the standard control flow structures:  for loop for i in { //i gets the values from 0 to 11, inclusive //i gets the values from 0 to 11, inclusive} for i in 0..<11 { //i gets the values from 0 to 10, inclusive //i gets the values from 0 to 10, inclusive}  while loop while condition { //run code //run code}

 Swift has built-in arrays and dictionaries  let creates immutable dictionary/array  var creates mutable dictionary/array  Immutable arrays: let numbers: [Int] = [1, 2, 3, 4, 5] numbers[2] = -1 //compile error numbers.append(6) //compile error  Mutable arrays: var names: [String] = ["Doncho", "Ivaylo"] names.append("Nikolay") //Doncho, Ivaylo, Nikolay names.append("Pesho") //Doncho, Ivaylo, Nikolay, Pesho names[3] = "Evlogi" //Doncho, Ivaylo, Nikolay, Evlogi  Same for dictionaries

Live Demo

Introducing the OOP principles in Swift

 Swift is an OOP language  Has classes, structures and protocols class Square{ var x: Float var x: Float var y: Float var y: Float var side: Float var side: Float init(x: Float, y: Float, side: Float){ init(x: Float, y: Float, side: Float){ self.x = x self.x = x self.y = y self.y = y self.side = side self.side = side } func calcArea() -> Float{ func calcArea() -> Float{ return self.side * self.side return self.side * self.side }}

Live Demo

 Protocols in Swift are pretty much the same as in Objective-C  Almost like interfaces in C# and Java  They provide a public interface for the conforming classes to implement protocol Movable{ func moveToX(x: Int, y: Int) func moveToX(x: Int, y: Int) func moveByDx(dx:Int, dy: Int) func moveByDx(dx:Int, dy: Int)} class Shape: Movable{ func moveToX(x: Int, y: Int){ func moveToX(x: Int, y: Int){ //implementation //implementation } func moveByDx(dx: Int, dy: Int){ func moveByDx(dx: Int, dy: Int){ //implementation //implementation }}

Live Demo

 A limited number of animatable properties  Custom animatable properties cannot be created  All animations are disabled by default  Animations are enabled only when using special constructs let view = UIView(frame: CGRectMake(x, y, w, h)) UIView.animateWithDuration( 1.0 animations: { animations: { let frame = CGRectMake(x + 100, let frame = CGRectMake(x + 100, y + 100, y + 100, w, w, h) h) view.frame = frame view.frame = frame});

UIView.animateWithDuration( 1.0 delay: 1.0 delay: 1.0 options: UIViewAnimationOptions.CurveEaseIn options: UIViewAnimationOptions.CurveEaseIn animations: { animations: { let frame = CGRectMake(x + 100, let frame = CGRectMake(x + 100, y + 100, y + 100, w, w, h) h) view.frame = frame view.frame = frame}, completion: { completion: { view.alpha = 0.5 view.alpha = 0.5});  UIKit Animations with Animation Blocks

Live Demo

форум програмиране, форум уеб дизайн курсове и уроци по програмиране, уеб дизайн – безплатно програмиране за деца – безплатни курсове и уроци безплатен SEO курс - оптимизация за търсачки уроци по уеб дизайн, HTML, CSS, JavaScript, Photoshop уроци по програмиране и уеб дизайн за ученици ASP.NET MVC курс – HTML, SQL, C#,.NET, ASP.NET MVC безплатен курс "Разработка на софтуер в cloud среда" BG Coder - онлайн състезателна система - online judge курсове и уроци по програмиране, книги – безплатно от Наков безплатен курс "Качествен програмен код" алго академия – състезателно програмиране, състезания ASP.NET курс - уеб програмиране, бази данни, C#,.NET, ASP.NET курсове и уроци по програмиране – Телерик академия курс мобилни приложения с iPhone, Android, WP7, PhoneGap free C# book, безплатна книга C#, книга Java, книга C# Николай Костов - блог за програмиране