반응형

iOS 312

Section19. 252) Core Data Fundamental / CRUD

Section19. 252) Core Data Fundamental OOP World Core Data World Database World Class Entity Table Property Attribute Field 전체: Table, Class, Entity Attributes (property) Buyers Address Number Who to Invoice Walmart 702.S.W. Street, Bentonville.... 1-800-925-6278 sam@walmart.com Tesco .... Whole Foods ..... 행: NSManagedObject Table안에 들어있는 각각의 요소들은 Core Data. NSManagedObject의 예시: Item 의 title, don..

Section19. 249) CoreData

Section19. 249) CoreData 어떤 프로젝트를 만들다가, 음 프로젝트에 들어갈 데이터가 그다지 많지 않을거같은데? 하고서 UserDefaults로 하다가 ... 만약 데이터 양이 많이 들어가야되는구나 라고 깨닫게 되는 순간, 해당 프로젝트에서 처음부터 CoreData 체크표시 안했더라도 중간과정에서도 CoreData를 추가할 수 있다. 다음과 같은 방법으로 .. cmd+N 을 눌러 새로운 파일 생성하는 식으로 아래를 연다. 그리고 Data Model을 선택한다. 그리고 동시에, 현재 작업하고 있던 프로젝트 외에 새로운 프로젝트를 Core Data 를 체크한 상태로 생성한다. 거기에서 AppDelegate.swift 를 연 다음, 아래 부분을 복사해서 원래의 프로젝트 AppDelegate.s..

Section19. 248) 데이터베이스 소개

Method Use UserDefaults Quickly persist small bits of data e.g. top score, player nickname, music on/off Codable Flash freeze custom objects 마치 아이스크림을 plist로 얼렸다가 먹고싶을 때 꺼내먹는 느낌 Keychain Save small bits of data securely SQLite Persist large amounts of data and query it. Core Data Object-oriented database Realm (오픈소스 프레임워크) A faster and easier database solution. (coredata 보다 빠르다). 장치에서 데이터를 로컬로 유지

Section19. 246) NSCoder로 데이터 인코딩/디코딩(save & load)

Section19. 246) NSCoder로 데이터 인코딩/디코딩하기 iOS sandbox 방식을 이용해서 Documents에 많은 정보를 저장하고 불러오는 방식. 즉, documents -> Info.plist에 저장하는 방식으로 하는 방법임 (사용자 커스텀 및 다양, 많은 정보 저장할 때 이용하는 방법 중 하나) - NSCoder. (UserDefaults로는 소소한 정보만을 저장할 뿐 사용자 커스텀 등 방대한 정보를 저장하지는 말자.) 데이터를 인코딩한다? = 본질적으로 한 데이터 유형을 다른 데이터유형으로 변환하는 것. ex) 음악 -> Encoder -> 비닐디스크 ex) 비닐디스크 -> Decoder -> 음악 func saveItems() => 사용자 정의 개체의 배열을 plist에 쓸 수 ..

Debug with breakpoint

Debug with breakpoint self.itemArray.append(textField.text!) 전/후로 달라진 itemArray를 보고 싶은 경우 ?? 1) 전 breakpoint 찍고나서, 디버그창에다가 print itemArray 치면 현재의 itemArray를 보여줌 (3가지) 2) 후 breakpoint를 무시하고 그 다음줄까지 쭉 실행시켜보고 싶으면 step over (디버그창의 왼쪽에서 두번째) 를 클릭해서 실행시킨뒤 다시 print itemArray로 출력해보면 됨.

iOS Rxswift Subject

iOS Rxswift Subject Subject란? Observable 및 Observer 의 기능을 같이 하는 것 (구독subscribe도하고, 값도 전달이 가능) Subject : 2가지 기능 = subscribe, next Subject에는 4가지가 있다 1) publish 2) behavior 3) replay 4) async (거의 안씀) 따라서 위의 1,2,3을 제대로 공부할 것 1) vs 2) 초기값의 유무 1) publish - 초기값 X 2) behavior : 초기값이 필수. 구독 전에 가장 최근 값을 같이 emit. ex) placeholder, 테이블뷰 초기값 등 3) replay let replay = ReplaySubject.create(bufferSize: 3) //buffe..

디버깅 5단계

1. What did you expect your code to do? 코드가 무엇을 하기를 기대했는가? ex) 1초마다 eggTimer progress bar가 1칸씩 움직여서 꽉 채워지길 바람 2. What happened instead? 그 대신에 무슨 일이 일어났는가? ex) 0으로 가버림 3. What does your expectation depend upon? 당신의 기대는 실제로 무엇에 달려있습니까? ex) 나눈 값이 십진수이어야. 4. How can we test the things our expectations depend on? 우리의 기대가 의존하는 것들을 어떻게 테스트할 수 있는가? print문 찍어보기 5. Fix our code to make reality match expec..

iOS swift Eggtimer - timer, progress bar

https://easy-coding.tistory.com/92 Swift 타이머(Timer) 사용 60초 카운트다운(CountDown)으로 동작하는 타이머 사용 예제입니다. 예제 코드 //타이머 변수 선언 var timer : Timer? //타이머에 사용할 번호값 var timerNum: Int = 0 //타이머 시작 public func startTimer().. easy-coding.tistory.com https://crazydeer.tistory.com/entry/iOSSwift-Progress-Bar-%EC%82%AC%EC%9A%A9%EB%B2%95 // egg button 클릭시 한번에 progress bar가 다 차게끔 하는 코드 progressbar.progress = 1.0 // How..

반응형