728x90

전체 글 334

[Udemy iOS & Swift Bootcamp] Command Line and Terminal

*Shell(쉘)과 Kernel(커넬) Shell: 사용자와 운영체제 간에 대화를 가능하게 해주는 명령어 해석기 역할 Kenel: 운영체제의 핵심. 소프트웨어와 하드웨어간의 커뮤니케이션을 관리하는 프로그램 *Shell 종류 1) 그래픽 사용자 인터페이스 쉘(GUI) 2 커맨드라인 인터페이스(CLI) *Bash = Bourne Again Shell : Unix 기반 Command Line 시스템 *Command Line 을 사용하는 이유? : 더 큰 통제력을 위해. 더 간단하고 빠름. * Command Line 명령어 ls 폴더 보기 cd ( change directory) 폴더 이동 cd ~ 루트 폴더로 이동 mkdir 폴더 생성 touch Text2.txt Text2.txt 파일 생성 oepn Text..

[Udemy iOS & Swift Bootcamp] iOS Application Lifecycle

앱의 상태 따라 수행해야할 일들이 있다. 이 때 iOS App Lifecycle 의 UIApplicationDelegate 함수들을 이용해서 처리해주자. https://developer.apple.com/documentation/uikit/app_and_environment/managing_your_app_s_life_cycle Managing your app’s life cycle | Apple Developer Documentation Respond to system notifications when your app is in the foreground or background, and handle other significant system-related events. developer.apple...

[Udemy iOS & Swift Bootcamp] ViewController Lifecycle

1. viewDidLoad() 호출. 모든 IBOutlet, IBAction 등 뷰와 관련된 모든 개체가 연결되어 access 가능상태가 됨. 2. viewWillAppear() 호출. 특정 UI 요소를 보여주거나 숨김처리 3. viewDidAppear() 호출 뷰가 화면에 나타나서 보여지게 됨. 4. viewWillDisappear() 호출 뒤로가기 버튼을 눌렀을 때, 뷰에서 어떤 화면 및 UI 요소를 삭제할지 5. vieDidDisappear() 호출 뷰가 화면에서 사라지게 됨. https://developer.apple.com/documentation/uikit/uiviewcontroller

[Udemy iOS & Swift Bootcamp] 채팅 완성하기 3 (상단 Navigation Bar 꾸미기)

3. 상단 네비게이션바 꾸미기 밋밋한 상단바를 꾸며주자. 1) 네비게이션 바의 색상 변경 navigation controller의 navigation bar 를 이용해서 전체 navigation bar의 bar tint 를 파란색으로 변경하고 폰트 색상과 크기를 변경했다. 참고로 상단 Navigation 바를 보이거나 숨기고 싶으면 navigationController의 isNavigationBarHidden 속성을 이용하면된다. https://developer.apple.com/documentation/uikit/uinavigationcontroller UINavigationController | Apple Developer Documentation A container view controller t..

[Udemy iOS & Swift Bootcamp] 채팅 완성하기 2 (최신 메세지(맨 아래)으로 화면 스크롤하기.)

2. 최신 메세지(맨 아래)으로 화면 스크롤하기. 채팅을 작성했을 때, 화면 스크롤을 맨 아래로 내려서 최신 메세지를 보여줘야 한다. tableView 에서 특정 셀로 스크롤 하는 함수는 scrollToRow 함수 이다. 특정셀 인덱스인 indexPath, 스크롤 포지션(top, bottom, middle), 스크롤 애니메이션 효과 true or false 인자가 들어간다. func loadMessages(){ db.collection(K.FStore.collectionName).order(by: K.FStore.dateField).addSnapshotListener { (querySnapshot, err) in self.messages = [] if let e = err { print("Error ge..

[Udemy iOS & Swift Bootcamp] 채팅 완성하기 1 (발신자/수신자 구분하기)

지금까지 만든 채팅앱에서 부족한 3가지를 채워보자. 1. 발신자/수신자 구분하기 2. 최신 메세지(맨 아래)으로 화면 스크롤하기. 3. 상단 네비게이션 바 꾸미기 1. 발신자/수신자 구분하기 1) 기존에 만들었던 Cell 에 another user 이미지 추가하기. 왼쪽의 기존 Cell 에 right Image 를 복사해서 왼쪽에 붙여넣고 You 이미지로 바꿔준다. 채팅 메세지가 본인이면 Me, 상대방이면 You 이미지를 보여주게 할 것이다. 2) MessageCell 스크립트에 leftImageView 객체 추가하기. 이미지 객체를 상황에 맞게 다룰 수 있도록 객체로 추가해주자. 3) ChatViewController 클래스에 코드 추가하기 extension ChatViewController: UITa..

[Udemy iOS & Swift Bootcamp] Keyboard 다루기

채팅 기능 구현 중, 키보드가 입력창을 가리는 이슈가 발생했다. 키보드가 위로 올라올 때, 입력창도 함께 올라와야 사용자가 불편하지 않을 것이다. 이 문제와 관련된 좋은 라이브러리가 있다. 바로 IQKeyboardManagerSwift. https://cocoapods.org/pods/IQKeyboardManagerSwift IQKeyboardManagerSwift Codeless drop-in universal library allows to prevent issues of keyboard sliding up and cover UITextField/UITextView. cocoapods.org 1. IQKeyboardManagerSwift 설치하기 Podfile 에 pod 'IQKeyboardManag..

[Udemy iOS & Swift Bootcamp] Firebase's Cloud Firestore

* Cloud Firestore: 모바일 앱 개발을 위한 Firebase의 최신 데이터베이스. Firestore | Firebase 유연하고 확장 가능한 NoSQL 클라우드 데이터베이스를 사용해 클라이언트 측 개발 및 서버 측 개발에 사용되는 데이터를 저장하고 동기화하세요. firebase.google.com Firebase에 2가지 데이터베이스가 있다. 기존 firebase 데이터베이스인 Realtime Database, 모바일 앱 개발을 위해 업데이트된 Cloud Firestore. 기존 firebase에 쿼리나 MongoDB 같은 현대 데이터베이스에서 얻을 수 있는 것을 원해서 업그레이드 되었다고 한다. 더 자세한 차이는 아래와 같다. [Cloud Firestore VS Realtime Databa..

[Udemy iOS & Swift Bootcamp] Type Casting

Type casting 에 사용되는 구문을 알아보자. is 데이터 타입 확인용 let cell = UITableViewCell() if cell is UITableViewCell { print("The types match!") } as? 다운캐스팅을 확인하고 변환하는 것. 주로 if 문과 함께 사용함. if let messageCell = cell as? MessageCell { //Then can use messageCell's capabilities } as! 데이터 타입을 서브 클래스로 변환 강제 다운 캐스팅. Forced Downcast let messageCell = cell as! MessageCell as 타입을 슈퍼 클래스로 바꾸는, 항상 옳은 Upcast let newCell = mes..

[Udemy iOS & Swift Bootcamp] Table View(DataSource, Delegate)

채팅 창에서 채팅 리스트를 출력하기 위해 Table View 를 사용해보자. Table View는 데이터를 뿌릴 DataSource와 리스트에 이벤트를 부여할 Delegate 프로토콜이 필요하다. 1) DataSource extension: table view에 index에 맞춰 데이터를 뿌리기 위함 2) Delegate extension: table view 리스트의 index에서 각각에 이벤트를 부여하기 위함 1. Table View 추가 View 에 Table View 를 추가하고 코드상에서 연결한다. 2. table view 의 dataSource 에 self 데이터를 부여해준다. IBOutlet 으로 UITableView를 연결해준다. 또한, viewDidLoad() 함수 내에서 뷰가 로드된 후..

728x90