iOS 정리/스위프트 정리 12

swift http 통신 get방식 post 방식 - 일단 기록

// // ShowBibleVC.swift // JooBo // // Created by MacBookPro on 2018. 6. 12.. // Copyright © 2018년 MacBookPro. All rights reserved. // import UIKit class ShowBibleVC: UIViewController { // let commentTextView: UITextView = { let textView = UITextView() textView.backgroundColor = UIColor(red:0.92, green:0.92, blue:0.92, alpha:1.0) textView.translatesAutoresizingMaskIntoConstraints = false textVie..

11. 클래스와 구조체

11. 클래스 //: Playground - noun: a place where people can play import UIKit //1//구조체 정의struct info { var name: String var age: Int} //2//구조체 인스턴스의 생성 및 초기화// 프로퍼티 이름(name, age)로 자동 생성된 이니셜라이저를 사용하여 구조체를 생성한다.var meinfo: info = info(name:"kang", age:24)meinfo.age = 100 //변경가능meinfo.name = "sola" //변경가능 let youinfo: info = info(name:"hong", age:55)// youinfo.age = 200 //변경불가 오류!// youinfo.name = "do..

10. 옵셔널

10. 옵셔널 //: Playground - noun: a place where people can play//값이 있을 수도 있고 없을 수도 있음을 나타낸다.//변수나 상수 등에 꼭 값이 있다는 것을 보장할 수 없다.(변수 또는 상수의 값이 nil일 수도 있다.)import UIKit //1var myName: String = "kim do do"//오류 nil은 String 타입에 할당 될 수 없다.//myName = nil //2//nil은 옵셔널로 선언된 곳에서만 사용될 수 있다.//옵셔널 변수의 선언 및 nil 할당var yourName: String? = "kang do"print(yourName) //Optional("kang do")yourName = nilprint(yourName) //..

9. 연산자의 종류

// 할당연산자 = // 산술 연산자 + - * / % //비교연산자 // 참조 비교 연산자let valueA: Int = 3let valueB: Int = 5let valueC: Int = 5class SomeClass{} //let isSameValue: Bool = valueA == valueB // falselet isSameValue: Bool = valueB == valueC // true print(isSameValue) let referenceA: SomeClass = SomeClass() let referenceB: SomeClass = SomeClass() let referenceC: SomeClass = referenceA let isSameReferenceAB: Bool = refe..

8. 열거형

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146//열거형 : 열거형은 연관된 항목들을 묶어서 표현할 수 있다.// 배열이나 딕셔너리 같은 타입과 다르게 프로그래머가 정의..

4. 컬렉션 타입 array dictionary set

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 5 컬랙션 타입 array, dictionary, set import Swift /*Array - 순서가 있는 리스트 컬렉션Dictionary - 키와 값의 쌍으로 이루어진 컬렉션Set - ..

3.기본 데이터 타입 Any AnyObject nil

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 3 기본 데이터 타입 //Bool, Int, UInt, Float, Double, Character, String // Bool var someBool: Bool = true someBool = false //someBool = 0 오류, Int 타입 넣을 수 없다. //someBool = 1 오류 //Int var someInt: Int = -100 //someInt = 100.1 오류, Double타입의 데이터를 넣어서 오류 //UInt 양의 정수 타입 var someUInt: UInt = 1..