IOS 65

[iOS / UIKit] Positioning Content Within Layout Margins

Positioning Content Within Layout Margins 레이아웃 여백 내에 콘텐츠 배치 Position views so that they are not crowded by other content. 다른 콘텐츠에 의해 몰리지 않도록 보기를 배치합니다. Overview Layout margins provide a visual buffer between a view’s content and any content outside of the view’s bounds. The layout margins consist of inset values for each edge (top, bottom, leading, and trailing) of the view. These inset values c..

UIKit 2022.02.05

[iOS / UIKit] Positioning Content Relative to the Safe Area

Positioning Content Relative to the Safe Area safe area에 대한 콘텐츠의 위치를 지정 Position views so that they are not obstructed by other content. 다른 내용에 방해되지 않도록 뷰를 배치합니다. Overview Safe areas help you place your views within the visible portion of the overall interface. UIKit-defined view controllers may position special views on top of your content. For example, a navigation controller displays a naviga..

UIKit 2022.02.05

[iOS / HIG] Adaptivity and Layout

Adaptivity and Layout 적응성 및 레이아웃 People generally want to be able to use their favorite apps on all of their devices and in any context. To meet this expectation, design an adaptable interface by configuring UI elements and layouts to automatically change shape and size on different devices, during multitasking on iPad, in split view, when the screen rotates, and more. 사람들은 일반적으로 자신이 좋아하는 앱을 모든 ..

HIG 2022.02.05

[iOS] 이미지 다운로드 속도 개선하기

오늘의 결과 화면입니다. url로부터 다운로드한 이미지를 imageView에 할당하는 방법은 이전 글에서 설명했습니다. 하지만 이 방법은 다운로드 속도가 매우 느립니다. Image View의 확장을 통해서 이미지 다운로드 속도를 개선해보겠습니다. [Step 1] UIImageView 파일 생성하기 [Step 2] Image View 확장하기 코드 extension UIImageView { func downloadImage(url: URL) { DispatchQueue.global().async { if let data = try? Data(contentsOf: url) { if let image = UIImage(data: data) { DispatchQueue.main.async { self.imag..

[iOS] url로 부터 이미지 다운로드하기

오늘의 결과 화면입니다. API를 통해서 가져온 데이터 중 이미지를 포함하고 있는 url로부터 ImageView에 이미지를 할당하는 방법을 알아보겠습니다. (API를 연동해서 데이터를 가져왔다고 가정하고 진행하겠습니다.) // url 변수의 타입은 URL입니다. if let data = try? Data(contentOf: url) { imageView.image = UIImage(data: data) } // 예시 if let data = try? Data(contentsOf: leagueScheduleTableViewCellModel.homeTeamImageUrl) { homeTeamImageView.image = UIImage(data: data) } 하지만 받아올 이미지 크고, 많으면 다음과 같이..

[iOS / Kingfisher / Error] failed: Processing image failed. Processor: DownsamplingImageProcessor(size: (0.0, 0.0) .. 에러 해결

Kingfisher를 이용해서 이미지를 가져올 때, 로딩이 되지 않는 이미지가 발생하면서 위와 같은 에러가 발생했습니다. 찾아보니 Processor에게 타당한 imageView.bounds.size를 전달하지 않아 발생한 에러입니다. Controller에서 cell을 생성하고 셀의 UI를 세팅하고 셀 내부 뷰의 프로퍼티를 업데이트하는 방식으로 구현했습니다. cell 내부 코드에서는 cell이 생성되기 전이기 때문에 cell의 크기를 0으로 인식해서 발생한 에러입니다. 기존에는 cell에서 정의한 ImageView의 크기에 맞게 설정한 것에서 매개변수에 직접 값을 설정하는 방식으로 바꾸니 에러가 해결됐습니다. ※ 참고 출처 Kingfisher/issues DownsamplingImageProcessor i..

Error 2022.01.25

[GitHub / iOS / Xcode] GitHub의 원격 저장소(Remote Repository) 생성하기

오늘의 결과 화면입니다. Xcode로 작업한 프로젝트를 GitHub의 레포지토리에 저장해보겠습니다. ※ Xcode에서 GitHub 계정을 연동한 상태에서 진행합니다. [Step 1] New Remote... 클릭 Xcode 좌측 Navigator에서 Show the Source Control navigator 클릭 -> main 우클릭 -> New Remote... 클릭 [Step 2] 해당 프로젝트의 원격 생성 레포지토리명, 레포지토리 볼 수 있는 권한, Remote Name 설정하고 Create 레포지토리 생성 완료! 이제 프로젝트를 수정 후, terminal에서 프로젝트의 경로로 이동해서 add + commit + push를 하게 되면 해당 레포지토리가 업데이트됩니다.

Git 2022.01.25

[iOS / CocoaPods / Error] CocoaPods could not find compatible versions ... 에러 해결

CocoaPods를 이용해서 Kingfisher를 설치하다가 위와 같은 에러가 발생했습니다. 왠지 Mac Air라서 생긴 에러인 것 같아서 찾아보니 역시나 M1 칩으로 생긴 오류였습니다. 해당 에러를 해결해보겠습니다. 터미널에서 해당 프로젝트 경로로 가서 다음의 명령문을 순서대로 입력 sudo arch -x86_64 gem install ffi arch -x86_64 pod install 그래도 안 된다면 arch -x86_64 pod install --repo-update ※ 참고 출처 stackoverflow Cocoapods subspec issue: None of your spec sources contain a spec satisfying the dependency I modified a rep..

Error 2022.01.18