728x90
출처 :Welcome to Swift
The Swift Programming Language
The Swift Programming Language(iTunes)
애플 새 개발언어 '스위프트' 이용 10개 팁
변수와 상수
상수 선언 - 키워드 let
let languageName = "Swift" languageName = "Swift++" // this is a compile-time error - languageName cannot be changed
변수 선언 - 키워드 var
var friendlyWelcome = "Hello!" friendlyWelcome = "Bonjour!" // friendlyWelcome is now "Bonjour!’
전역 로그 출력
print, println 함수 - 자바의 System.out.print, System.out.println 와 동일한 기능으로 xcode 의 output 창에 출력하는 함수 제공
println("This is a string") // prints "This is a string
주석
한줄 주석 (Single-line) : forward-slashes (//)
// this is a comment
여러줄 주석 (multiline comments) : 주석 시작 (/*) 주석 끝 (*/)
/* this is also a comment, but written over multiple lines */
- 작성중 -
Xcode6 설치
Xcode 실행
Create a new Xcode project 선택
Single View Application 선택
Language : Swift 선택
Label, Button Control 추가
Label Control 변수로 등록
Label 이름 등록
Button Touch Down 이벤트 추가
Button 이벤트 이름 등록
Hello World 출력
실행
728x90