iOS 44

[ iOS ] CompositionLayout ๋ฐฉํ–ฅ ์ดํ•ดํ•˜๊ธฐ

๐Ÿ“– CompositionalLayoutCollectionView์˜ CompositionalLayout์€ Section, Group, Item์œผ๋กœ ๊ตฌ์„ฑ๋˜์–ด์žˆ๋‹ค. ์—ฌ๊ธฐ์—์„œ Group์€ NSCollectionLayoutItem ์˜ ํ•˜์œ„ ํด๋ž˜์Šค์ด๊ธฐ ๋•Œ๋ฌธ์— Group ์•ˆ์— Group์ด ๋“ค์–ด๊ฐˆ ์ˆ˜๋„ ์žˆ๋‹ค.       ๐Ÿšฅ Section๊ณผ Group์˜ ๋ฐฉํ–ฅCompositionalLayout์—์„œ๋Š” Section์˜ ๋ฐฉํ–ฅ๊ณผ Group์˜ ๋ฐฉํ–ฅ์„ ์„ค์ •ํ•  ์ˆ˜ ์žˆ๋‹ค. Group์˜ item ๋ฐฐ์น˜ ๋ฐฉํ–ฅ์€ .vertical๊ณผ .horizontal ๋ฉ”์„œ๋“œ๋กœ ์ง€์ •ํ•ด์ค„ ์ˆ˜ ์žˆ๊ณ , Section์˜ scroll ๋ฐฉํ–ฅ์€ UICollectionViewCompositionalLayoutConfiguration์„ ํ†ตํ•ด ์„ค์ •ํ•  ์ˆ˜ ์žˆ๋‹ค.  ์œ„ ๊ทธ๋ฆผ์„..

iOS 2024.06.27

[ iOS ] ๋ฐ์ดํ„ฐ ์œ ๋ฌด์— ๋”ฐ๋ผ CollectionView UI ๋ณ€๊ฒฝํ•˜๊ธฐ with DiffableDataSource, Snapshot

๊ธ€์„ ๊ฒŒ์‹œํ•œ ์ดํ›„ ์ฝ”๋“œ์— ๋ฌธ์ œ๊ฐ€ ์žˆ๋‹ค๋Š” ๊ฑธ ๋ฐœ๊ฒฌํ•ด ์ด๋ฅผ ์ˆ˜์ •ํ–ˆ์Šต๋‹ˆ๋‹ค!๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜๊ธฐ๊นŒ์ง€ ์‹œํ–‰์ฐฉ์˜ค๊ฐ€ ๊ถ๊ธˆํ•˜์‹œ๋‹ค๋ฉด ์ด ๊ธ€ ๋ด์ฃผ์„ธ์š”~ [ iOS ์‹œํ–‰์ฐฉ์˜ค ] CollectionView์— Cell์ด ํ•˜๋‚˜๋งŒ ๋ณด์ด๋Š” ์ด์œ ๐Ÿ‘ฉ‍๐Ÿ’ป๋ฐฐ๊ฒฝ๐Ÿ‘ฉ‍๐Ÿ’ปChapterList๋ฅผ ๊ฐœ๋ฐœํ•˜๋˜ ์ค‘, ๋ถ„๋ช… item์ด 3๊ฐœ๊ฐ€ ์žˆ๋Š”๋ฐ cell์ด 1๊ฐœ๋งŒ ๋ณด์ด๋Š” ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ–ˆ๋‹ค! ๊ทธ๋ž˜์„œ ์ด์ „์— ์ž‘์—…ํ–ˆ๋˜ BookList์—์„œ๋„ ํ™•์ธํ•ด ๋ณด๋‹ˆ ๋˜‘๊ฐ™์€ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ–ˆ๋‹ค.. BookList88yhtserof.tistory.com         1๏ธโƒฃ ๊ตฌํ˜„ํ•˜๊ธฐ ์ „์— ๋จผ์ € ์•Œ์•„๋ณด๊ธฐ โ˜๏ธ ๊ตฌํ˜„ ๊ฐ„๋žต ์š”์•ฝCell๊ณผ Section, Item์„ BookList์™€ Empty ๋‘ ๊ฒฝ์šฐ๋กœ ๊ตฌ๋ถ„ํ•˜์—ฌ, ๋ฐ์ดํ„ฐ ์œ ๋ฌด๋ฅผ ํ™•์ธํ•œ ํ›„ DiffableDataSource์— Cell์„ ๋“ฑ..

iOS 2024.06.17

[ iOS ] ์ž๋™ ์ฐธ์กฐ ์นด์šดํŒ…, ARC (Automatic Reference Counting)

์ž๋™ ์ฐธ์กฐ ์นด์šดํŒ… Automatic Reference Counting Swift๋Š” ์•ฑ์˜ ๋ฉ”๋ชจ๋ฆฌ ์‚ฌ์šฉ๋Ÿ‰์„ ์ถ”์ ํ•˜๊ณ  ๊ด€๋ฆฌํ•˜๊ธฐ ์œ„ํ•ด ์ž๋™ ์ฐธ์กฐ ์นด์šดํŒ…(ARC)๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค. ๋”ฐ๋ผ์„œ ๊ฐœ๋ฐœ์ž๋Š” ๋ฉ”๋ชจ๋ฆฌ ๊ด€๋ฆฌ์— ์‹ ๊ฒฝ ์“ฐ์ง€ ์•Š์•„๋„ ๋œ๋‹ค. ARC์— ์˜ํ•ด ๋” ์ด์ƒ ํ•„์š”ํ•˜์ง€ ์•Š๋Š” ์ธ์Šคํ„ด์Šค๋Š” ์ž๋™์œผ๋กœ ๋ฉ”๋ชจ๋ฆฌ์—์„œ ํ• ๋‹น ํ•ด์ œ๋˜๊ธฐ ๋•Œ๋ฌธ์ด๋‹ค. ํ•˜์ง€๋งŒ ํด๋ž˜์Šค ๋“ฑ๊ณผ ๊ฐ™์ด ์ฐธ์กฐํƒ€์ž…์˜ ๊ฒฝ์šฐ ์ฐธ์กฐ ๊ด€๊ณ„์— ์˜ํ•ด ์ž๋™ ๋ฉ”๋ชจ๋ฆฌ๊ด€๋ฆฌ๊ฐ€ ๋˜์ง€ ์•Š๋Š” ๊ฒฝ์šฐ๊ฐ€ ์žˆ๋‹ค. ์ด๋Ÿฌํ•œ ๊ฒฝ์šฐ ๋ฉ”๋ชจ๋ฆฌ๊ฐ€ ๋‚ญ๋น„๋˜๋Š”๋ฐ, ์ด๋ฅผ ๋ฉ”๋ชจ๋ฆฌ ๋ˆ„์ˆ˜(memory leak)๋ผ๊ณ  ํ•œ๋‹ค. ๊ฐ„๋‹จํ•˜๊ฒŒ ์ƒ๊ฐํ•˜๋ฉด, ์‚ฌ์šฉํ•˜์ง€๋„ ์•Š๊ณ  ์‚ฌ์šฉํ•  ์ˆ˜๋„ ์—†๋Š” ์ง์ด ๋ฐฉ ํ•œ ์ผ ์— ๊ณ„์† ์กด์žฌํ•˜๋Š” ๊ฒƒ์ด๋‹ค. ARC ์˜ ์ž‘๋™์›๋ฆฌ ํด๋ž˜์Šค์˜ ์ƒˆ๋กœ์šด ์ธ์Šคํ„ด์Šค๊ฐ€ ์ƒ์„ฑ๋  ๋•Œ, ARC๋Š” ํ•ด๋‹น ์ธ์Šคํ„ด์Šค์— ๋Œ€ํ•œ ์ •๋ณด๋ฅผ ๋ฉ”๋ชจ๋ฆฌ ์ฒญํฌ์— ํ• ๋‹น..

iOS 2024.03.27

[ iOS ] ํ™”๋ฉด ์บก์ณํ•˜๊ธฐ - UIGraphicsRenderer

๐Ÿ”ซ ๋ฌธ์ œ ๋ฐœ์ƒ iOS 17๊ฐ€ ๋ฐœํ‘œ๋˜๋ฉฐ, ์•ฑ์Šคํ† ์–ด์— ๋ฐฐํฌํ•œ ์„œ๋น„์Šค์— ํ˜น์‹œ deprecated๋œ ํด๋ž˜์Šค๋‚˜ ๋ฉ”์„œ๋“œ๊ฐ€ ์žˆ์„๊นŒ ์‹ถ์–ด ์ฐพ์•„๋ดค๋‹ค. ์ •๋ง ์•ˆํƒ€๊น๊ฒŒ๋„ '์ด๋ฏธ์ง€ ๊ณต์œ ํ•˜๊ธฐ' ๊ธฐ๋Šฅ์—์„œ ์‚ฌ์šฉํ–ˆ๋˜ UIGraphicsBeginImageContextWithOptions(_:_:_:)๊ฐ€ iOS 17.0 ๋ฒ„์ „๊นŒ์ง€๋งŒ ์ œ๊ณต๋œ๋‹ค๊ณ  ํ•œ๋‹ค... ๊ทธ๋ž˜์„œ ์–ด๋–ป๊ฒŒ ๋ฒ„์ „ ์—…์„ ํ• ๊นŒ ๊ฑฑ์ •ํ•˜๋ฉฐ ๊ณต์‹ ๋ฌธ์„œ์—์„œ Graphic, Image, Render๋ฅผ ํ‚ค์›Œ๋“œ๋กœ ๋น„์Šทํ•œ ๊ธฐ๋Šฅ์„ ํ•˜๋Š” ํด๋ž˜์Šค ๋˜๋Š” ๋ฉ”์„œ๋“œ๋ฅผ ์ฐพ์•„๋ดค๋‹ค. ๋‹คํ–‰ํžˆ ๋ฉ€์ง€ ์•Š๊ฒŒ Drawing ์นดํ…Œ๊ณ ๋ฆฌ์—์„œ UIGraphicsRenderer ํด๋ž˜์Šค๋ฅผ ๋ฐœ๊ฒฌํ–ˆ๋‹ค! ์ด์ œ ์ด ํด๋ž˜์Šค๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ iOS 17 ์ดํ›„๋ฅผ ๋Œ€์‘ํ•˜๋Š” ๋ฆฌํŒฉํ† ๋ง์„ ์‹œ์ž‘ํ•ด๋ณด์ž. ๐ŸŽจ UIGraphicsRenderer UIGraphics..

iOS 2023.12.22

[ iOS ] ์—ด๊ฑฐํ˜•์˜ ์›์‹œ๊ฐ’์œผ๋กœ ํŠœํ”Œ ์‚ฌ์šฉํ•˜๊ธฐ

enum Direction: String { case up = "์ƒ" case down = "ํ•˜" case left = "์ขŒ" case right = "์šฐ" } let direction: Direction = .right print(direction.right) /// print "์šฐ" ์—ด๊ฑฐํ˜•์—๋Š” ์›์‹œ๊ฐ’(rawValue)์ด ์žˆ์–ด ์œ„์˜ ์˜ˆ์‹œ์ฒ˜๋Ÿผ ๊ฐ’์„ case๋ณ„๋กœ ๊ฐ’์„ ํ• ๋‹นํ•ด ํ•„์š”ํ•  ๋•Œ ๊บผ๋‚ด ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋‹ค. ํ•˜์ง€๋งŒ ํ•œ ๊ฐ€์ง€ ์œ ์˜ํ•  ์ ์€, ์ด ์›์‹œ๊ฐ’์€ Literal ํƒ€์ž…๋งŒ ๊ฐ€๋Šฅํ•˜๋‹ค. Literal์€ ๊ณต์‹๋ฌธ์„œ์—์„œ "์ˆซ์ž๋‚˜ ๋ฌธ์ž์—ด ๊ฐ™์€ ํƒ€์ž…์˜ ๊ฐ’ ํ‘œํ˜„"์ด๋ผ ์„ค๋ช…๋˜์–ด ์žˆ๋‹ค. ๊ทธ๋ ‡๋‹ค๊ณ  ํƒ€์ž…์„ ๊ฐ–๊ณ  ์žˆ์ง€๋Š” ์•Š๋‹ค. ํ•˜์ง€๋งŒ literal์€ ์•„์ฃผ์•„์ฃผ ์ •ํ™•ํ•˜์—ฌ Swift์˜ ํƒ€์ž… ์ถ”๋ก  ๊ธฐ๋Šฅ์„ ์‚ฌ์šฉํ•ด ํƒ€์ž…์ด ์ถ”๋ก ๋œ๋‹ค. ๋”ฐ๋ผ์„œ ..

iOS 2023.12.01

[ iOS ] MVC - 3 ) Controller ๊ฐ์ฒด

Controller object๋ฅผ ์ฝ๊ณ  ์ •๋ฆฌํ•œ ๊ธ€์ž…๋‹ˆ๋‹ค. Controller object Retired Document Important: This document may not represent best practices for current development. Links to downloads and other resources may no longer be valid. Controller object A controller object acts as a coordinator or as an intermediary between one developer.apple.com Controller object Controller ๊ฐ์ฒด๋Š” ํ•˜๋‚˜ ์ด์ƒ์˜ ๋ทฐ ๊ฐ์ฒด์™€ ๋ชจ๋ธ ๊ฐ์ฒด ์‚ฌ์ด์˜ ์กฐ์ •์ž ๋˜๋Š” ์ค‘์žฌ์ž๋กœ์„œ ๋™์ž‘..

iOS 2023.11.18

[ iOS ] MVC - 2 ) Model ๊ฐ์ฒด

Model Object๋ฅผ ์ฝ๊ณ  ์ •๋ฆฌํ•œ ๊ธ€์ž…๋‹ˆ๋‹ค. Model object Retired Document Important: This document may not represent best practices for current development. Links to downloads and other resources may no longer be valid. Model object A model object is a type of object that contains the data of an application, pro developer.apple.com Model object ๋ชจ๋ธ ๊ฐ์ฒด๋Š” MVC ๋””์ž์ธ ํŒจํ„ด ์ค‘ Model์— ํ•ด๋‹นํ•˜๋Š” ์—ญํ• ์„ ์ˆ˜ํ–‰ํ•˜๋ฉฐ, ๋ชจ๋ธ ๊ฐ์ฒด์˜ ์ฃผ์š” ์—ญํ• ์€ ๋‹ค์Œ๊ณผ ๊ฐ™๋‹ค: ๋ฐ์ดํ„ฐ ..

iOS 2023.11.18

[ iOS ] MVC - 1) MVC๋ž€?

Model - View - Controller ์•„ํ‹ฐํด์„ ์ฝ๊ณ  ์ •๋ฆฌํ•œ ๊ธ€์ž…๋‹ˆ๋‹ค. Model-View-Controller Retired Document Important: This document may not represent best practices for current development. Links to downloads and other resources may no longer be valid. Model-View-Controller The Model-View-Controller (MVC) design pattern assigns objects in an ap developer.apple.com MVC๋ž€? MVC๋Š” Model - View - Controller ๋กœ ๊ตฌ์„ฑ๋˜์–ด ์žˆ๋Š” ๋””์ž์ธ ํŒจํ„ด์œผ๋กœ..

iOS 2023.10.17

[ Rx ] ๊ฒฐํ•ฉ ์—ฐ์‚ฐ - 1. withLatestFrom

withLatestFrom func withLatestFrom(_ second: Source) -> Observable where Source : ObservableConvertibleType Summary ํ•ด๋‹น ์˜ต์ ธ๋ฒ„๋ธ”์ด element๋ฅผ ๋ฐฉ์ถœํ•  ๋•Œ๋งˆ๋‹ค ๋‘ ๋ฒˆ์งธ ์˜ต์ ธ๋ฒ„๋ธ”์˜ ๊ฐ€์žฅ ์ตœ์‹  element๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋‘ ๊ฐœ์˜ ์˜ต์ ธ๋ฒ„๋ธ”์„ ํ•œ ๊ฐœ์˜ ์˜ต์ ธ๋ฒ„๋ธ”๋กœ ๋ณ‘ํ•ฉํ•œ๋‹ค. Discussion Note ๋‘ ๋ฒˆ์งธ ์˜ต์ ธ๋ฒ„๋ธ”์ด element๋ฅผ ๋ฐฉ์ถœํ•˜๊ธฐ ์ „, ํ•ด๋‹น ์˜ต์ ธ๋ฒ„๋ธ”์ด element๋ฅผ ๋ฐฉ์ถœํ•œ๋‹ค๋ฉด ๊ทธ๊ฑด ๋ˆ„๋ฝ๋  ๊ฒƒ์ด๋‹ค. ์ฆ‰, ์•„๋ฌด๋Ÿฐ ์ž‘์—…๋„ ์ผ์–ด๋‚˜์ง€ ์•Š๋Š”๋‹ค. Parameters ๋งค๊ฐœ๋ณ€์ˆ˜๋กœ๋Š” ๋‘ ๋ฒˆ์งธ ์˜ต์ ธ๋ฒ„๋ธ”์ด ์˜จ๋‹ค Returns ํ•ด๋‹น ์˜ต์ ธ๋ฒ„๋ธ”์˜ element์™€ ๋‘ ๋ฒˆ์งธ ์˜ต์ ธ๋ฒ„๋ธ”์˜ ์ตœ์‹  element ๊ฐ๊ฐ์„ ๊ฒฐํ•ฉํ•œ ๊ฒฐ๊ณผ๋ฅผ ํฌํ•จํ•˜๋Š”..

iOS/Rx 2023.10.06

[ iOS ] Link Presentation ์•Œ์•„๋ณด๊ธฐ

Link Presentation | Apple Developer Documentation Fetch, provide, and present rich links in your app. developer.apple.com ๐ŸŽฌ ๊ธ€์„ ์‹œ์ž‘ํ•˜๋ฉฐ Link Presentation์€ ์•ฑ์„ ๊ฐœ๋ฐœํ•  ๋•Œ ์‚ฌ์šฉํ–ˆ๋˜ Framework๋กœ, Share Sheet๋ฅผ ์ž„์˜๋กœ ๊ตฌ์„ฑํ•˜๊ธฐ ์œ„ํ•ด ์‚ฌ์šฉํ–ˆ๋‹ค. ํ•˜์ง€๋งŒ title๊ณผ content๋งŒ์œผ๋กœ ๊ตฌ์„ฑํ–ˆ๊ธฐ ๋•Œ๋ฌธ์— ์ด framework๋ฅผ ์ž˜ ์‚ฌ์šฉํ–ˆ๋‹ค๊ณ  ํ•˜๊ธด ์–ด๋ ต๋‹ค. ์ด๋ฒˆ์— ํ”„๋กœ์ ํŠธ์—์„œ ๋ชจ์ž„ ์ •๋ณด๋ฅผ ๊ณต์œ ํ•  ๋•Œ ๋งํฌ๋ฅผ ์ฒจ๋ถ€ํ•˜๊ธฐ ์œ„ํ•ด Link Presentation๋ฅผ ์‚ฌ์šฉํ•  ์˜ˆ์ •์ด๋‹ค. ๊ทธ ์ „์— ๊ณต์‹ ๋ฌธ์„œ์™€ WWDC ์˜์ƒ์„ ํ†ตํ•ด Link Presentation์„ ๊ผผ๊ผผํ•˜๊ฒŒ ์ •๋ฆฌํ•˜๋ ค ํ•œ๋‹ค. โœ‰๏ธ Link ..

iOS 2023.08.18

[ iOS ] Bounds์™€ Frame ๋น„๊ต - 2. Size

๐Ÿค” ๋ฌธ์ œ ๐Ÿค” Bounds์™€ Frame์˜ ์ฐจ์ด๋Š” ๋ญ˜๊นŒ? UIView์—๋Š” bounds ํ”„๋กœํผํ‹ฐ์™€ frame ํ”„๋กœํผํ‹ฐ๊ฐ€ ์žˆ๋‹ค. ๊ณต์‹ ๋ฌธ์„œ๋ฅผ ๋ด๋„ ๋‘˜์˜ ์ฐจ์ด๋Š” ํฌ๊ฒŒ ์™€๋‹ฟ์ง€ ์•Š๋Š”๋‹ค. ๋”ฐ๋ผ์„œ StoryBoad๋ฅผ ์‚ฌ์šฉํ•ด ์‹ค์Šตํ•˜๋ฉฐ View์˜ Bounds์™€ Frame์„ ๋น„๊ต ๋ถ„์„ ํ•ด๋ณด์ž! 1ํŽธ ๋ณด๊ธฐ [ iOS ] Bounds์™€ Frame ๋น„๊ต - 1. ๊ณต์‹๋ฌธ์„œ์™€ origin ๐Ÿค” ๋ฌธ์ œ ๐Ÿค” Bounds์™€ Frame์˜ ์ฐจ์ด๋Š” ๋ญ˜๊นŒ? UIView์—๋Š” bounds ํ”„๋กœํผํ‹ฐ์™€ frame ํ”„๋กœํผํ‹ฐ๊ฐ€ ์žˆ๋‹ค. ๊ณต์‹ ๋ฌธ์„œ๋ฅผ ๋ด๋„ ๋‘˜์˜ ์ฐจ์ด๋Š” ํฌ๊ฒŒ ์™€๋‹ฟ์ง€ ์•Š๋Š”๋‹ค. ๋”ฐ๋ผ์„œ StoryBoad๋ฅผ ์‚ฌ์šฉํ•ด ์‹ค์Šตํ•˜๋ฉฐ View์˜ Bounds์™€ Fra 88yhtserof.tistory.com 2. Size 1ํŽธ์— ์ด์–ด 2ํŽธ์—์„œ๋Š” bounds์™€ frame..

iOS 2023.07.01

[ iOS ] Bounds์™€ Frame ๋น„๊ต - 1. ๊ณต์‹๋ฌธ์„œ์™€ origin

๐Ÿค” ๋ฌธ์ œ ๐Ÿค” Bounds์™€ Frame์˜ ์ฐจ์ด๋Š” ๋ญ˜๊นŒ? UIView์—๋Š” bounds ํ”„๋กœํผํ‹ฐ์™€ frame ํ”„๋กœํผํ‹ฐ๊ฐ€ ์žˆ๋‹ค. ๊ณต์‹ ๋ฌธ์„œ๋ฅผ ๋ด๋„ ๋‘˜์˜ ์ฐจ์ด๋Š” ํฌ๊ฒŒ ์™€๋‹ฟ์ง€ ์•Š๋Š”๋‹ค. ๋”ฐ๋ผ์„œ StoryBoad๋ฅผ ์‚ฌ์šฉํ•ด ์‹ค์Šตํ•˜๋ฉฐ View์˜ Bounds์™€ Frame์„ ๋น„๊ต ๋ถ„์„ ํ•ด๋ณด์ž! 1. ๊ณต์‹๋ฌธ์„œ์™€ origin ๐Ÿ“š๊ณต์‹๋ฌธ์„œ ํ™•์ธํ•˜๊ธฐ Bounds์˜ ๊ณต์‹๋ฌธ์„œ /UIKit /Views and controls /UIView /bounds Instance Property bounds ์ž์ฒด ์ขŒํ‘œ ์‹œ์Šคํ…œ์œผ๋กœ ํ•ด๋‹น view์˜ ์œ„์น˜์™€ ํฌ๊ธฐ๋ฅผ ํ‘œํ˜„ํ•˜๋Š” ๊ฒฝ๊ณ„ ์‚ฌ๊ฐํ˜• ๊ธฐ๋ณธ์ ์ธ bound ์›์ ์€ (0, 0)์ด๊ณ , size๋Š” frame ํ”„๋กœํผํ‹ฐ์— ์žˆ๋Š” ์‚ฌ๊ฐํ˜•์˜ size์™€ ๋™์ผํ•˜๋‹ค. ์ด ์‚ฌ๊ฐํ˜•์˜ size ๋ณ€ํ™”๋Š” center point๋ฅผ ๊ธฐ์ค€์œผ..

iOS 2023.06.30
728x90