본문 바로가기

iOS/STUDY

(56)
[iOS] UISwipeActionsConfiguration https://developer.apple.com/tutorials/app-dev-training/adding-and-deleting-reminders Apple Developer Documentation developer.apple.com iOS App Dev Trutorials를 공부하고 적은 글입니다. 사진과 같이 UICollectionView (list) 에서 왼쪽으로 swipe 액션을 취했을 때 Delete 버튼이 나올 수 있도록 설정을 해줄겁니다. (Delete는 왼쪽 끝까지 swipe 하면 자동으로 실행됩니다 -> performsFirstActionWithFullSwipe: Bool) UISwipeActionsConfiguration The set of actions to perform wh..
[iOS] Realm의 특징 개인 프로젝트로 Realm을 사용하기 위해 특징과 알아보겠습니다. open source object database management system, initially for mobile operating systems (Android / iOS) 모바일에 특화된 오픈소스 객체 데이터베이스 관리 시스템입니다. Realm 특징 Realm은 NoSQL 입니다. Realm은 객체 중심 데이터베이스 입니다. → ORM 이 필요하지 않고 개발자에게 직관적입니다. iOS와 Android 간 DB 공유가 가능합니다. 코드로 작업할 수 있습니다. → SQL과 같은 중간 쿼리 언어를 사용하지 않습니다. 메인 스레드에서 읽기/ 쓰기를 할 수 있습니다. → 다중 쓰레드에서의 Realm 객체 관리가 어렵습니다. (쓰레드별 객..
[cocoapods] M1 mac cocoapods 설치 오류 해결 1. [ Finder - 이동 - 유틸리티 ] 에서 터미널 애플리케이션을 찾아준다. 2. 터미널 우클릭 - 정보 가져오기 - Rosetta를 사용하여 열기 클릭 (터미널 우클릭으로 복제 후 그 터미널에서 클릭해도 된다.) 3. 이전에 이것저것 건들였다면 brew cleanup -d -v 4. ffi 설치 sudo arch -x86_64 gem install ffi 5. cocoapods 설치 sudo gem install cocoapods 6. Rosetta 로 실행하기 끄기 pod init 후 pod install 을 하려면 arch -x86_64 pod install
[Swift] Int - quotientAndRemainder(dividingBy:) 문서에서 Int 의 Instance Method를 구경하던 도중 발견한 함수! 최근에 몫과 나머지를 사용한 문제를 종종 풀었는데 그때마다 직접 나누고 나머지를 따로 구했는데 한번에 구할 수 있는 함수를 알아두기 위해서 기록기록 func quotientAndRemainder(dividingBy rhs: Int) -> (quotient: Int, remainder: Int) let x = 1_000_000 let (q, r) = x.quotientAndRemainder(dividingBy: 933) // q == 1071 // r == 757 (몫, 나머지) 형태로 반환해준다. x 선언할 때 _ 을 쓰는건 처음본다.. 신기하니 기억해두자
[iOS] Diffable Data Source (CollectionView, TableView) UICollectionViewDiffableDataSource에 대한 이해를 자세하게 하기 위해 작성하였습니다. TableView, CollectionView 에서 사용하는 DataSource를 구성하는 방법에는 두가지가 있습니다. UICollectionViewDataSource protocol The methods adopted by the object you use to manage data and provide cells for a collection view. 데이터를 관리하고 collection view에 대한 cell을 제공합니다. UICollectionViewDiffableDataSource The object you use to manage data and provide cells for ..
[iOS] Identifiable 프로토콜 https://developer.apple.com/tutorials/app-dev-training/making-reminders-identifiable#Make-the-Model-Identifiable Apple Developer Documentation developer.apple.com Apple의 UIKit Tutorial (미리알림 앱)을 보고 공부한 내용을 정리한 글입니다. diffable data source는 collection view의 각 항목 ID를 나타내는 identifier list를 저장합니다. 이전 강의에서는 미리알림의 title 제목을 identifier로 지정하여 저장했는데 미리알림의 제목을 변경하거나 동일한 제목의 미리 알림(Reminder)이 있다면 그 cell을 나타내는..
[iOS] extension + Generic where https://developer.apple.com/tutorials/app-dev-training/making-reminders-identifiable Apple Developer Documentation developer.apple.com 오늘도 Apple 의 튜토리얼을 따라하다가 extension 에서 where 을 추가해서 사용하는 것을 보고 궁금해서 글을 적어봅니다. extension Array where Element == Reminder { func indexOfReminder(with id: Reminder.ID) -> Self.Index { guard let index = firstIndex(where: { $0.id == id }) else { fatalError() } return in..
[iOS] Format the Date and Time https://developer.apple.com/tutorials/app-dev-training/displaying-cell-info Apple Developer Documentation developer.apple.com Apple UIKit 튜토리얼 배운 것을 공부하여 정리하였습니다. 우선 배운 것을 정리하면 Foundation 프레임워크를 사용하고 해당하는 장소에 따라 시간을 비교하여 오늘인지 아닌지, 오늘이라면 'Today', 오늘이 아니라면 'Mar 8' 이렇게 나타내는 방법을 배웠습니다. Foundation 프레임워크의 Date 구조체를 extension해서 dayAndTimeText String 변수를 만들었습니다. dayAndTimeText extension Date { var dayAn..