전체 글 130

Dictionary 관련 함수

Dictionary.init(uniqueKeysWithValues:) 키-값 쌍의 시퀀스로부터 새로운 딕셔너리를 생성하는 Dictionary의 이니셜라이저이다.  입력으로 (Key, Value) 튜플의 시퀀스를 받고, 중복된 키가 있으면 런타임 에러가 발생한다. 만약, 키가 중복된다면 Dictionary.init(_:uniqueKeysWith:) 함수를 이용하면 된다고 한다. 예제다음 코드는 문자열 배열을 키, 정수를 값으로 하는 새 Dictionary를 생성하는 예제이다.let digitWords = ["one", "two", "three", "four", "five"]let wordToValue = Dictionary(uniqueKeysWithValues: zip(digitWords, 1...5))p..

코딩 테스트 2025.02.18

WWDC 18 - iOS Memory Deep Dive - 1

이번 글에서는 이미지의 메모리 최적화와 관련이 있는 다운샘플링에 대해 알아보려고 한다. 주 내용은 WWDC 2018 - iOS Memory Deep Dive 영상에서의 간단한 이미지 관련 기초 지식과 ImageIO, ImageSource를 이용한 이미지 다운샘플링에 대해 다룰 예정이다.이미지 메모리WWDC에 따르면, 이미지의 메모리 사용량은 파일 크기가 아니라 이미지의 dimensions, 즉, 너비와 높이와 연관이 있다고 한다. 간단한 예제를 살펴보면 iOS에서 파일 크기는 590KB이고, 이미지 자체의 사이즈는 2048x1536의 크기의 이미지를 불러오기 위해 메모리가 얼마나 사용될까?  무려 10MB라고 한다. 이는 이미지가 처리되는 과정과 랜더링에 사용되는 포맷을 살펴보면 알 수 있다. 이미지가..

WWDC 2025.01.24

Combine - 5

https://developer.apple.com/videos/play/wwdc2019/721/ Combine in Practice - WWDC19 - Videos - Apple DeveloperExpand your knowledge of Combine, Apple's new unified, declarative framework for processing values over time. Learn about how to...developer.apple.comIntergrating Combine앱 사용을 위한 회원가입을 예로 들어보자. 우선, 비밀번호 설정 관련 부분을 보면, 목표는 비밀번호, 비밀번호 확인 두 필드가 일치하고 두 필드의 길이가 8 자 이상인지 확인하는 것이다. 기본 설정으로 interf..

ETC 2024.12.13

Combine - 4

https://developer.apple.com/videos/play/wwdc2019/721/ Combine in Practice - WWDC19 - Videos - Apple DeveloperExpand your knowledge of Combine, Apple's new unified, declarative framework for processing values over time. Learn about how to...developer.apple.com Combine - 3을 이어서 위 동영상 정리Scheduled Operators일상에서 일정을 잡는 것처럼, Scheduled operators는 특정 이벤트가 언제 그리고 어디로 전달되는지 일정을 잡는다. RunLoop와 DispatchQueue..

ETC 2024.12.13

Combine - 3

https://developer.apple.com/videos/play/wwdc2019/721/ Combine in Practice - WWDC19 - Videos - Apple DeveloperExpand your knowledge of Combine, Apple's new unified, declarative framework for processing values over time. Learn about how to...developer.apple.com 위 영상 내용 정리 Combine 기초 내용은 Combine -2에서Error HandlingCombine 사용 시 발생 가능한 에러에 대한 처리는 매우 중요하다고 한다. 모든 Publisher/Subscriber는 발생 가능한 에러에 대해 직접 ..

ETC 2024.12.12