Code Monkey home page Code Monkey logo

lampuikit's Introduction

LampUIkit

map based app

๐Ÿ“– ์ƒ์„ธ ๋‚ด์šฉ

Apple Store

https://apps.apple.com/kr/app/lamp-๋žจํ”„-์—ฌํ–‰-์ง€๋„/id1641478631

GitHub

https://github.com/umaKim/LampUIkit

๐Ÿ‘ฅ Team Composition

  • 1 iOS Developer - Kim Yoonsuk (Uma Kim)
  • 1 Backend Developer
  • 1 Designer
  • 1 Product Manager (Presenter)

๐Ÿ› ๏ธ Technologies and Libraries Used

  • Swift, iOS
  • Combine
  • AutoLayout
  • FloatingPanel
  • SDWebImage
  • GoogleMap SDK
  • SkeletonView
  • Lottie
  • Alamofire
  • CombineCocoa
  • UmaBasicAlertKit
  • Kakao SDK
  • Quick, Nimble

๐Ÿ“ฑ Features Implemented (iOS)

  • Implemented asynchronous processing to display map pins with animation in the order that the photos are loaded
  • Utilized Combine framework for implementation
  • Reduced code duplication and increased code reusability through modularization
  • Implemented all UI and functionalities programmatically without using Storyboard
  • Implemented animation for changes in cells using DiffableDataSource introduced in WWDC 19
  • Used SDWebImage library for image caching to prevent performance degradation during image loading
  • Implemented auto cell sizing based on content length for variable cell height and improved user experience
  • Implemented localization support for English and Japanese languages
  • Implemented language switching functionality within the app
  • Wrote unit tests (in early stages, not fully completed)

๐Ÿ‘จโ€๐Ÿญ Problem Encountered and Solution 1

  • Problem:

    When fetching and displaying approximately 30 locations on the map, the entire process takes about 10 seconds. During this time, the user is forced to view a loading screen, resulting in a poor user experience.

  • Problem Analysis:

    To understand what happens during the loading screen, I listed the sequence of events:

    1. Fetch an array containing information and image links of 30 locations.
    2. Pass the information and image links of each element in the array to a map pin object.
    3. The object fetches the image using the provided image link, and once all images are fetched, it proceeds to the next location and performs the same operation.
    4. After completing this process for all 30 locations, the loading screen is removed, and the map with map pins is displayed to the user.

    The step that takes the most time is step 3, where images are fetched using URLs. This process is time-consuming because it waits for each image to be fully fetched before proceeding to the next one, blocking the main thread.

  • Solution:

    Instead of waiting for all image data to be fetched, I implemented a solution where each image is displayed as soon as it is fetched. This gives the impression to the user that the map is being updated without any loading time.

    : Execute the try? Data(contentsOf: url) part asynchronously on a background thread, and once the image data is fetched, update the view on the main thread.

๐Ÿ’โ€โ™‚๏ธ Problem Encountered and Solution 2

  • Problem:

    Following the existing approach, to implement fetching data from a new API, I had to repeatedly write similar code that was already written for other API calls.

  • Desired Approach:

    Enable fetching of desired APIs by simply adding the endpoint, without having to write repetitive code.

  • Solution:

    By using generics, I minimized the duplication of code. I actively utilized enums so that by simply adding the endpoint, the desired API could be used immediately.

๐Ÿ‘ฅ ํŒ€ ๊ตฌ์„ฑ

  • iOS ๊ฐœ๋ฐœ์ž 1๋ช… โ† ๊น€์œค์„
  • ์„œ๋ฒ„ ๊ฐœ๋ฐœ์ž 1๋ช…
  • ๋””์ž์ด๋„ˆ 1๋ช…
  • ๊ธฐํš์ž(๋ฐœํ‘œ์ž) 1๋ช…

๐Ÿ› ๏ธ ์‚ฌ์šฉ ๊ธฐ์ˆ  ๋ฐ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ

  • Swift, iOS
  • Combine
  • AutoLayout
  • FloatingPanel
  • SDWebImage
  • GoogleMap SDK
  • SkeletonView
  • Lottie
  • Alamofire
  • CombineCocoa
  • UmaBasicAlertKit
  • Kakao SDK
  • Quick, Nimble

๐Ÿ“ฑ ๋‹ด๋‹นํ•œ ๊ธฐ๋Šฅ (iOS)

  • ๋น„๋™๊ธฐ ์ฒ˜๋ฆฌ๋ฅผ ํ†ตํ•ด์„œ map pin๋“ค์ด ์‚ฌ์ง„์ด ๋กœ๋”ฉ ๋˜๋Š” ์ˆœ์„œ๋กœ ์• ๋‹ˆ๋ฉ”์ด์…˜๊ณผ ํ•จ๊ป˜ ํ™”๋ฉด์— ๋ณด์ด๊ฒŒ ํ•จ
  • Combine์„ ์‚ฌ์šฉํ•ด์„œ ๊ตฌํ˜„
  • ๋ชจ๋“ˆํ™”๋ฅผ ํ†ตํ•ด์„œ ์ฝ”๋“œ์˜ ์–‘์„ ์ค„์ด๊ณ  ์ฝ”๋“œ ์žฌํ™œ์šฉ์„ฑ์„ ๋†’์ž„
  • ๋ชจ๋“  UI์™€ ๋™์ž‘์„ Storyboard์—†์ด ์ฝ”๋“œ๋กœ๋งŒ ๊ตฌํ˜„
  • WWDC 19์— ์†Œ๊ฐœ๋๋˜ DiffableDatasource๋ฅผ ์ ์šฉํ•ด์„œ Cell์— ์ƒ๊ธฐ๋Š” ๋ณ€ํ™”์— ๋Œ€ํ•œ ์• ๋‹ˆ๋ฉ”์ด์…˜ ๊ตฌํ˜„
  • SD web image ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ์ด์šฉํ•ด์„œ image caching์„ ๊ฐ€๋Šฅํ•˜๊ฒŒ ํ•ด์„œ ์ด๋ฏธ์ง€ ๋กœ๋”ฉ์‹œ ๋ฐœ์ƒํ• ์ˆ˜ ์žˆ๋Š” ์•ฑ์˜ ํผํฌ๋จผ์Šค ์ €ํ•˜๋ฅผ ๋ฐฉ์ง€
  • ์‚ฌ์šฉ์ž๊ฐ€ ์ž‘์„ฑํ•œ ๊ธ€์— ์–‘์— ๋”ฐ๋ผ ์…€์˜ ํฌ๊ธฐ๊ฐ€ ๋ณ€ํ• ์ˆ˜ ์žˆ๊ฒŒ auto cell sizing์„ ์ ์šฉํ•ด์„œ ux๋ฅผ ํ–ฅ์ƒ
  • ์˜์–ด, ์ผ๋ณธ์–ด ์ง€์› Localization ๊ตฌํ˜„
  • ์•ฑ ๋‚ด๋ถ€์—์„œ ์–ธ์–ด ๋ฐ”๊พธ๊ธฐ ๊ธฐ๋Šฅ ๊ตฌํ˜„
  • Unit test ์ž‘์„ฑ ( ์™„์ „ํžˆ ๋๋‚ด์ง€๋Š” ์•Š์Œ - ์•„์ง ์ดˆ๋ฐ˜ ๋‹จ๊ณ„ )

๐Ÿ‘จโ€๐Ÿญ ๋ฐœ์ƒ๋œ ๋ฌธ์ œ์™€ ํ•ด๊ฒฐ ๋ฐฉ๋ฒ• 1

  • ๋ฌธ์ œ:

    ์ง€๋„์ƒ์— ๋“ฑ์žฅํ•˜๋Š” ์•ฝ 30๊ฐœ์˜ ์žฅ์†Œ๋ฅผ fetchํ•˜๊ณ  map pin์œผ๋กœ ๋„์›Œ์ฃผ๋Š” ๋ชจ๋“  ๋™์ž‘์ด ์™„๋ฃŒํ•  ๋•Œ๊นŒ์ง€ ๋กœ๋”ฉ ํ™”๋ฉด์„ ๋„์›Œ์ค€๋‹ค. ๊ทธ๋Ÿฐ๋ฐ ์ด ๋ชจ๋“  ๊ณผ์ •์ด ์™„๋ฃŒ๋˜๋Š” ๋ฐ์—๋Š” ์•ฝ 10์ดˆ ์ •๋„ ์†Œ์š”๋œ๋‹ค. ์•ฝ 10์ดˆ ๋™์•ˆ ์‚ฌ์šฉ์ž๋Š” ๋กœ๋”ฉ ํ™”๋ฉด๋งŒ์„ ๋ณด๊ณ  ์žˆ์–ด์•ผ ํ•œ๋‹ค. ์ด๊ฒƒ์€ ์‚ฌ์šฉ์ž์—๊ฒŒ ๋ถˆ์พŒํ•œ ๊ฒฝํ—˜์„ ์ค€๋‹ค.

  • ๋ฌธ์ œ ํŒŒ์•…:

    ๋ฌธ์ œํŒŒ์•…์„ ์œ„ํ•ด ๋กœ๋”ฉํ™”๋ฉด์ด ๋„์›Œ์ ธ ์žˆ๋Š” ๋™์•ˆ ๋ฌด์Šจ์ผ์ด ์ผ์–ด๋‚˜๋Š”์ง€ ๋‚˜์—ดํ•ด ๋ณด์•˜๋‹ค.

    1. ์žฅ์†Œ์˜ ์ •๋ณด์™€ ์ด๋ฏธ์ง€ ๋งํฌ๊ฐ€ 30๊ฐœ ๋‹ด๊ฒจ์žˆ๋Š” ๋ฐฐ์—ด์„ ๋ถˆ๋Ÿฌ์˜จ๋‹ค. โ†’ 2. ํ•ด๋‹น ๋ฐฐ์—ด์— ์žˆ๋Š” ๊ฐ ์š”์†Œ์— ์žˆ๋Š” ์ •๋ณด๋“ค๊ณผ ์ด๋ฏธ์ง€ ๋งํฌ๋ฅผ map pin ๊ฐ์ฒด์— ๋„˜๊ธด๋‹ค. โ†’ 3. ๊ฐ์ฒด๋Š” ๋ฐ›์€ ์ด๋ฏธ์ง€ ๋งํฌ๋ฅผ ํ†ตํ•ด ์ด๋ฏธ์ง€๋ฅผ ๋ฐ›์•„์˜ค๊ณ  ๋‹ค ๋ฐ›์•„ ์™”์œผ๋ฉด ๋‹ค์Œ ์žฅ์†Œ์— ๋Œ€ํ•œ ๋ฐ์ดํ„ฐ๋“ค์„ ๊ฐ€์ง€๊ณ  ๋‹ค์Œ ๊ฐ์ฒด์—์„œ ๊ฐ™์€ ์ž‘์—…์„ ํ•ด์ค€๋‹ค. โ†’ 4. 3๋ฒˆ ์ž‘์—…์„ 30๋ฒˆ์„ ๋‹ค ์™„๋ฃŒํ•˜๊ณ  ๋‚˜๋ฉด ๋กœ๋”ฉ ํ™”๋ฉด์„ ์ œ๊ฑฐํ•˜๊ณ  ์‚ฌ์šฉ์ž์—๊ฒŒ map pin๋“ค์ด ์˜ฌ๋ ค์ ธ ์žˆ๋Š” ์ง€๋„๋ฅผ ๋ณด์—ฌ์ค€๋‹ค.
    2. ์—ฌ๊ธฐ์—์„œ ๊ฐ€์žฅ ๊ธด ์‹œ๊ฐ„์ด ์†Œ์š”๋˜๋Š” ๊ฒƒ์€ 3๋ฒˆ ๊ณผ์ •์ด๋‹ค. ๋‹ค๋ฅธ ๊ณผ์ •๊ณผ๋Š” ๋‹ค๋ฅด๊ฒŒ URL์„ ํ†ตํ•ด ์ด๋ฏธ์ง€๋ฅผ ๋ถˆ๋Ÿฌ์˜ค๋Š” ๊ณผ์ •์ด ์˜ค๋ž˜ ๊ฑธ๋ฆฐ๋‹ค๋Š” ๊ฒƒ์„ ํŒŒ์•…ํ–ˆ๋‹ค. ์ด ๊ณผ์ •์—์„œ ์˜ค๋ž˜ ๊ฑธ๋ฆฌ๋Š” ์ด์œ ๋Š” main thread์—์„œ ํ•œ ๊ฐ์ฒด์˜ ์ด๋ฏธ์ง€๊ฐ€ ๋‹ค ๋ถˆ๋Ÿฌ์˜ฌ ๋•Œ๊นŒ์ง€ ๊ธฐ๋‹ค๋ ธ๋‹ค๊ฐ€ ๋‹ค์Œ ์ด๋ฏธ์ง€๋ฅผ ๋ถˆ๋Ÿฌ์˜ค๋Š” ์‹์ด์–ด์„œ ๊ทธ๋ ‡๋‹ค.
  • ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•:

    ๋ชจ๋“  image data๊ฐ€ ๋ฐ›์•„ ์˜ฌ๋•Œ๊นŒ์ง€ ๊ธฐ๋‹ค๋ฆฌ๋Š” ๊ฒƒ์ด ์•„๋‹ˆ๋ผ, ํ•œ ์ด๋ฏธ์ง€๊ฐ€ ๋ฐ›์•„ ์™€์กŒ์œผ๋ฉด ํ•ด๋‹น ์ด๋ฏธ์ง€๋ถ€ํ„ฐ ๋จผ์ € ํ™”๋ฉด์— ๋„์›Œ์ฃผ๋Š” ๋ฐฉ์‹์œผ๋กœ ๊ณ ์ณ์•ผ ํ•œ๋‹ค. ์ด๋Ÿฐ ์‹์œผ๋กœ ๊ณ ์นœ๋‹ค๋ฉด ์‚ฌ์šฉ์ž ์ž…์žฅ์—์„œ๋Š” ๋กœ๋”ฉ ์‹œ๊ฐ„์ด ์—†์ด ์ง€๋„๊ฐ€ ์—…๋ฐ์ดํŠธ๋˜๋Š” ๊ฒƒ ์ฒ˜๋Ÿผ ๋ณด์ด๊ฒŒ ๋œ๋‹ค.

    <๊ธฐ์ˆ ์  ํ•ด๊ฒฐ>: try? Data(contentsOf: url) ์ด ๋ถ€๋ถ„์„ Background Thread์—์„œ ๋น„๋™๊ธฐ๋กœ ์‹คํ–‰์‹œ์ผœ์ฃผ๊ณ  image data๊ฐ€ ๋ฐ›์•„์™€์ง€๋ฉด ๊ทธ๋•Œ main thread์—์„œ view๋กœ ์—…๋กœ๋“œํ•ด์ค€๋‹ค.

๐Ÿ’โ€โ™‚๏ธ ๋ฐœ์ƒ๋œ ๋ฌธ์ œ์™€ ํ•ด๊ฒฐ ๋ฐฉ๋ฒ• 2

  • ๋ฌธ์ œ:

    ๊ธฐ์กด์— ์›๋ž˜ํ•˜๋˜ ๋ฐฉ์‹์„ ๊ณ ์ง‘ํ•˜์ž๋ฉด, ์ƒˆ๋กœ์šด API๋ฅผ ๋ถˆ๋Ÿฌ์˜ค๋Š” ๊ฒƒ์„ ๊ตฌํ˜„ํ•˜๊ธฐ ์œ„ํ•ด์„œ ๊ธฐ์กด์— ๋‹ค๋ฅธ API ํ˜ธ์ถœ์‹œ์— ์ž‘์„ฑํ•ด๋’€๋˜ ํ•จ์ˆ˜์™€ ๋งค์šฐ ์œ ์‚ฌํ•œ ์ฝ”๋“œ๋ฅผ ๋ฐ˜๋ณตํ•ด์„œ ์ž‘์„ฑํ•ด์•ผํ•œ๋‹ค.

  • ์›ํ•˜๋Š” ๋ฐฉํ–ฅ:

    endpoint๋งŒ ์ถ”๊ฐ€ํ•˜๋ฉด ๋ฐ”๋กœ api๋ฅผ ์›ํ•˜๋Š” ๊ณณ์—์„œ ๋ถˆ๋Ÿฌ์˜ค๊ฒŒ ํ•˜๋Š”๊ฒƒ

  • ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•:

    generic์„ ์ด์šฉํ•ด์„œ ๊ธฐ์กด์˜ ๋ฐ˜๋ณต๋˜๋Š” ์ฝ”๋“œ๋ฅผ ์ตœ์†Œํ™”ํ•จ. enum์„ ์ ๊ทน์ ์œผ๋กœ ํ™œ์šฉํ•ด์„œ endpoint๋งŒ ์ถ”๊ฐ€ํ•˜๋ฉด ๋ฐ”๋กœ ์›ํ•˜๋Š” api๋ฅผ ์‚ฌ์šฉํ• ์ˆ˜ ์žˆ๊ฒŒํ–ˆ๋‹ค.

lampuikit's People

Contributors

umakim avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.