BEGINNING ios PROGRAMMING

Similar documents
ios Application Development Lecture 2: Seminar and Unit 1

Swift. Introducing swift. Thomas Woodfin

Maxime Defauw. Learning Swift

Classes Classes 2 / 35

Classes Classes 2 / 36

Settings. Mobile Application Development in ios School of EECS Washington State University Instructor: Larry Holder

Lecture 4: Build Systems, Tar, Character Strings

Agenda. Excep,ons Object oriented Python Library demo: xml rpc

Debugging and Profiling

Algebraic data types. The case against null

Programming Paradigms

SWIFT - TYPE CASTING

Registering for the Apple Developer Program

CMSC201 Computer Science I for Majors

learning objectives learn about variables, their types and their values learn about different number representations

Stanford CS193p. Developing Applications for ios. Fall CS193p. Fall

iphone Application Programming Lecture 3: Swift Part 2

CISC 110 Week 3. Expressions, Statements, Programming Style, and Test Review

Xcode 6 and ios 8 What s New for Software Developers

C Programming Primer 8/31/15 1

Mobile Computing Professor Pushpendra Singh Indraprastha Institute of Information Technology Delhi Java Basics Lecture 02

Functional Reactive Programming on ios

Functions and Collections. Dr. Sarah Abraham

Objec0ves. Gain understanding of what IDA Pro is and what it can do. Expose students to the tool GUI

CS2304: Python for Java Programmers. CS2304: Sequences and Collections

Do not turn this page until you have received the signal to start.

WRITING CONSOLE APPLICATIONS IN C

Introduction. two of the most fundamental concepts in computer science are, given an array of values:

Introduction to OCaml

Automa'c Test Genera'on

1 Build Your First App. The way to get started is to quit talking and begin doing. Walt Disney

CMSC 330: Organization of Programming Languages. OCaml Imperative Programming

CSCI-GA Scripting Languages

Go Forth and Code. Jonathan Gertig. CSC 415: Programing Languages. Dr. Lyle

Using Eclipse for C Programming

Fundamentals: Expressions and Assignment

Mutation. COS 326 Andrew W. Appel Princeton University. slides copyright David Walker and Andrew W. Appel

Programming Languages and Techniques (CIS120)

C++ for Everyone, 2e, Cay Horstmann, Copyright 2012 John Wiley and Sons, Inc. All rights reserved. Using a Debugger WE5.

Lab 0 Introduction to the MSP430F5529 Launchpad-based Lab Board and Code Composer Studio

Topic 6: Types COS 320. Compiling Techniques. Princeton University Spring Prof. David August. Adapted from slides by Aarne Ranta

SWIFT BASICS

CMSC330 Spring 2017 Midterm #1 Solution

Data Handing in Python

Understanding Undefined Behavior

CS101: Fundamentals of Computer Programming. Dr. Tejada www-bcf.usc.edu/~stejada Week 1 Basic Elements of C++

Xcode & Swift: Introduction

ITP 342 Mobile App Dev. Functions

Abstraction Functions Lecture 9 Fall 2005

Separate Compilation Model

lecture 1 hello, swift cs : spring 2018

Introduction to Swift. Dr. Sarah Abraham

CSCI 1100L: Topics in Computing Lab Lab 11: Programming with Scratch

CSCE121: Introduction to Program Design and Concepts Practice Questions for Midterm 1

Sample file. Practice Exam One COMPUTER SCIENCE A SECTION I. Directions: Determine the answer to each of the following questions or incomplete

Chapter 2 Welcome App

Introduction to Python. Fang (Cherry) Liu Ph.D. Scien5fic Compu5ng Consultant PACE GATECH

ITP 342 Mobile App Dev. Strings

Lecture 12: Abstraction Functions

Numerical Computing in C and C++ Jamie Griffin. Semester A 2017 Lecture 2

Proofs about Programs

CS354 gdb Tutorial Written by Chris Feilbach

CMSC 330: Organization of Programming Languages. OCaml Imperative Programming

CS Lecture 5: Pattern Matching. Prof. Clarkson Fall Today s music: Puff, the Magic Dragon by Peter, Paul & Mary

CS 2340 Objects and Design - Scala

SWIFT - PROTOCOLS. Protocols also follow the similar syntax as that of classes, structures, and enumerations:

A Func'onal Introduc'on. COS 326 David Walker Princeton University

CSE 413 Languages & Implementation. Hal Perkins Winter 2019 Structs, Implementing Languages (credits: Dan Grossman, CSE 341)

Computer Sciences 368 Scripting for CHTC Day 3: Collections Suggested reading: Learning Python

Chapter 1. Data types. Data types. In this chapter you will: learn about data types. learn about tuples, lists and dictionaries

CMSC330 Spring 2017 Midterm #1 9:30am/11:00am/12:30pm/5:00pm

CS 251 Intermediate Programming Methods and Classes

CS 251 Intermediate Programming Methods and More

Visualize ComplexCities

PIC 20A The Basics of Java

Mobile Computing Professor Pushpedra Singh Indraprasth Institute of Information Technology Delhi Andriod Development Lecture 09

Project 6 Due 11:59:59pm Thu, Dec 10, 2015

Stanford CS193p. Developing Applications for ios. Spring CS193p. Spring 2016

Refresher: Interface Specifications. ADT Documentation. Set Represented as an Array. Representation Invariant, Abstraction Function

CSC 581: Mobile App Development Spring 2019

Representation Invariant, Abstraction Function

Using the Xcode Debugger

CSE413: Programming Languages and Implementation Racket structs Implementing languages with interpreters Implementing closures

Questions. Exams: no. Get by without own Mac? Why ios? ios vs Android restrictions. Selling in App store how hard to publish? Future of Objective-C?

Assignment I: Concentration

Duration 5 days (For basic crowd 5+3days needed)

CSC/MAT-220: Lab 6. Due: 11/26/2018

Chapter 6 - Pointers

Design and Debug: Essen.al Concepts Numerical Conversions CS 16: Solving Problems with Computers Lecture #7

CS Summer 2013

CSE 451: Operating Systems. Sec$on 2 Interrupts, system calls, and project 1

JUnit tes)ng. Elisa Turrini

Gerontechnology II. Collecting Smart Phone Sensor Data for Gerontechnology. Using ios

Introduction to Object-Oriented Programming

ios 9 SDK Development

The plan. Racket will return! Lecture will not recount every single feature of Java. Final project will be wri)ng a Racket interpreter in Java.

Assignment II: Foundation Calculator

Mobile Development - Lab 2

CS201 - Assignment 1, Part 2 Due: Wednesday February 19, at the beginning of class

Programming Languages and Techniques (CIS120)

Transcription:

BEGINNING ios PROGRAMMING GEORGIA TECH RESEARCH NETWORK OPERATIONS CENTER (RNOC) *slides are based on the presentations by Professor Russell J Clark and Brian Davidson

Swi$ Objec+ve- C OPTIONS RubyMo+on Xamarin Hybrid

Swift Safe, Modern and Powerful h<ps://developer.apple.com/library/ios/documenta+on/swi$/conceptual/ Swi$_Programming_Language/

PROGRAMMING 101 Programming Data Code Mutable Immutable Procedural Object- Oriented

DATA In programming you use a convenience name to represent memory where the data is actually stored. let namedarea = DATAVALUE! var namedarea = DATAVALUE!

IMMUTABLE DATA Immutable data is never modified name value let greeting : String = Hello World! constant type (explicit) let greeting = Hello World!

MUTABLE DATA Mutable data is can be modified name value var greeting : String = Hello World! variable type (explicit) var greeting = Hello World!

COMMENTS Comments are a way for the programmer to add notes to himself or others who will read the code, but the compiler will ignore and they won t exist in the final binary // this is a single line comment! /* this is! a multi-line! comment */!

Besides strings you have OTHER TYPES Fundamental Int Whole numbers Eg. 42 Double & Float Floa+ng- point numbers Eg. 42.0, 42.034 Bool True or false Collec+on Array Items accessed via index Index starts from 0 Dic4onary Store key- value pairs Access element via keys Tuple

ARRAY An array is a collec+on of data items which can be accessed via an index beginning with 0 var cardsuits : [String] = [ Spades, Diamonds, Hearts, Clubs ] var cardsuits = [ Spades, Diamonds, Hearts, Clubs ] println(cardsuits[0])

DICTIONARY A dic+onary is similar to a hash table and allows you to store key- value pairs and access the value by providing the key. var cards = ["Jack" : 11, "Queen" : 12, "King" : 13] cards[ Ace ] = 1 println(cards[ Ace ]) cards[ Ace ] = 14 println(cards[ Ace ])

OPTIONAL VARIABLES There are instances where you some+mes need to denote the lack of a value which is different from an empty value or zero, for this swi$ has op+onals which says either There is a value, and it equals x or There isn t a value at all

OPTIONAL VARIABLES For instance if I was wri+ng code to convert a string to an integer I would like to note when it was unable to convert Int("42") -> Int(42)! Int("0") -> Int(0)! Int("foobar") ->?! As not all strings can be integers, I need to signify that the result of my code isn t just an Int but an Int that may not exist Int?

nil A special value used to represent the lack of a value var somestring": String?! // somestring is automatically set to nil! Or you can specifically assign a value to nil var someint: Int? = 42! // someint contains an actual Int value of 42! someint = nil! // someint now contains no value!

nil You can check if an op+onal value has a value or not by comparing it to nil ( somestring == nil )! // will succeed if somestring doesn t have a value! // will fail if somestring is an empty string or any other string! ( someint"!= nil )! // will succeed if someint has a value! // will succeed if someint has the value zero!

OPTIONAL VALUE Once you know if a variable has a value you can access the inner value by force unwrapping it with (! ) let unwrappedint : Int = someint!! let unwrappedint = someint!!!

! CONTROL FLOW - LOOPING Loop over the collec+ons while! do-while! for! for-in!!

! CONTROL FLOW - CONDITIONALS Condi+onal Statements if! if-else! if-else if-else! switch!!

CONTROL FLOW while Execute a block of code when something is true while incomplete { println( Downloading ) while!complete{ println( Downloading )

CONTROL FLOW do-while Execute a block of code at least once var incomplete = false do { println( Downloading ) while incomplete

CONTROL FLOW for & for-in Execute a block of code for every item or a subset of items in a collec+on for var i = 0; i < cardsuits.count; i++ { println(cardsuits[i]) forcardsuit in cardsuits { println(cardsuit)

CONTROL FLOW if Execute a block of code that meets a condi+on if cardvalue == 11 { println("jack") else if cardvalue == 12 { println("queen") else { println("not found")

CONTROL FLOW switch Execute a block of code that matches a condi+on or run a default block switch cardvalue { case 11: println("jack") case 12: println("queen") case 13: println( King") case 14: println( Ace ) default: println("not found")

FUNCTIONS We ve been using println so how do we create our own?! func printcard(cardname : String){ func printcard(){ println( Ace ) println(cardname) func printcard(cardname : String, cardvalue : Int){ println( \(cardname) : \(cardvalue) )

FUNCTIONS No return value! func printcard(cardname : String, cardvalue : Int){ println( \(cardname) : \(cardvalue) ) Return value! func buildcard(cardname : String, cardvalue : Int) - > String { return \(cardname) : \(cardvalue)

CLASS A class holds data as well as func+ons that act upon that data class Animal{ let species: String let weight: Double let age: Int

CLASS - INITIALIZER A class holds data as well as func+ons that act upon that data class Animal{ let species: String let weight: Double let age: Int init(species: String, weight: Double, age: Int){ self.species = species self.weight = weight self.age = age

CLASS - FUNCTION A class holds data as well as func+ons that act upon that data class Animal{ let species: String let weight: Double let age: Int... func printdetails(){ println( Species- \(self.species): Weight- \(self.weight): Age- \(self.age) )

CLASS - SUBCLASSES A series of objects can be modeled into a hierarchy. A Cat is an Animal therefore it is a subclass of an Animal class Cat: Animal { let furcolor: String init(species: String, weight: Double, age: Int){ furcolor = Brown super.init(species, weight: weight, age: age) init(species: String, weight: Double, age: Int, furcolor: String){ self.furcolor = furcolor super.init(species, weight: weight, age: age)

XCODE

XCODE INTERFACE

XCODE WORKSPACE TOOLBAR

XCODE OPTIONAL AREAS Naviga4on Area U4li4es Area Debug Area

XCODE NAVIGATION AREA Project navigator. Add, delete, group, and otherwise manage files in your project, or choose a file to view or edit its contents in the editor area. Symbol navigator. Browse the symbols in your project as a list or hierarchy. Bu<ons on the le$ of the filter bar let you limit the shown symbols to only classes and protocols, just those in your project, and containers. Find navigator. Use search op+ons and filters to quickly find any string within your project. Issue navigator. View issues such as diagnos+cs, warnings, and errors found when opening, analyzing, and building your project. Test navigator. Create, manage, run, and review unit tests. Debug navigator. Examine the running threads and associated stack informa+on at a specified point or +me during program execu+on. Breakpoint navigator. Fine- tune breakpoints by specifying characteris+cs such as triggering condi+ons. Report navigator. View the history of your build, run, debug, con+nuous integra+on, and source control tasks.

XCODE TYPES OF EDITORS Source editor. Write and edit source code. Interface Builder. Graphically create and edit user interface files. Project editor. View and edit how your apps should be built, such as by specifying build op+ons, target architectures, and app en+tlements.

TODO LIST WALKTHROUGH DEMO