ํ‹ฐ์Šคํ† ๋ฆฌ ๋ทฐ

๋ฐ˜์‘ํ˜•


๐Ÿฅ• Texture ์„ค์น˜ํ•˜๊ธฐ(Install Texture)


๐Ÿ“ ๊ฐœ์š”


  • Texture๋ฅผ ์„ค์น˜ํ•˜๋Š” ๊ณผ์ •์„ ์‚ดํŽด๋ณด๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค! Texture๊ฐ€ ๋ฌด์—‡์ธ์ง€์— ๋Œ€ํ•œ ์ž์„ธํ•œ ์ด์•ผ๊ธฐ๋Š” ๋‹ค๋ฅธ ๊ธ€์—์„œ ์ถ”ํ›„ ์„ค๋ช…ํ•˜๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.


    Texture ๊ณต์‹ github


    ์šฐ์„  ์ด๋ฒˆ ๊ธ€์€ ์–ด๋–ป๊ฒŒ ์„ค์น˜ํ•˜๋Š”์ง€ ๊ทธ ๊ณผ์ •์„ ๋”ฐ๋ผ๊ฐ€๋ณด๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค :)


๐Ÿ›  CocoaPods ์„ค์น˜ํ•˜๊ธฐ


  • Texture ๊ณต์‹ github์„ ์‚ดํŽด๋ณด๋ฉด installation์—์„œ ์„ค์น˜๋ฅผ ์œ„ํ•ด ๋‘๊ฐ€์ง€ ๋ฐฉ๋ฒ•์ด ์žˆ์Šต๋‹ˆ๋‹ค.


    1. CocoaPods
    2. Carthage

    ์ €๋Š” CocoaPods๋ฅผ ์ด์šฉํ•ด ์„ค์น˜๋ฅผ ์ง„ํ–‰ํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค. ์šฐ์„  CocoaPods์˜ ์„ค์น˜๊ฐ€ ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.


    $ sudo gem install cocoapods

    ์ •์ƒ์ ์œผ๋กœ ์„ค์น˜๋˜์‹œ๋Š” ๋ถ„๋“ค๋„ ์žˆ๊ฒ ์ง€๋งŒ, ์ €์˜ ๊ฒฝ์šฐ(BigSur 11.4, M1 Mac) ์•„๋ž˜์™€ ๊ฐ™์€ ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค.


    ERROR: While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /usr/bin directory.


    ๊ฒ€์ƒ‰ํ•ด๋ณด๋‹ˆ Mac์˜ ์‹œ์Šคํ…œ Ruby๋ฅผ ์‚ฌ์šฉํ•˜๊ธฐ ๋•Œ๋ฌธ์— ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ–ˆ๊ณ , ํ•ด๊ฒฐ๋ฒ•์˜ ์ž์„ธํ•œ ์„ค๋ช…์€ ์•„๋ž˜ ๋ธ”๋กœ๊ทธ์— ๋‚˜์™€์žˆ์Šต๋‹ˆ๋‹ค.

    ํ•ด๊ฒฐ๋ฒ•


    ๊ฐ„๋žตํ•˜๊ฒŒ ์ •๋ฆฌํ•˜๋ฉด ํ•„์š”ํ•œ ๋ช…๋ น์€ ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค.


    $ brew update
    
    $ brew install rbenv ruby-build
    
    $ rbenv install -l // Ruby ๋ฒ„์ „์ด ๋‚˜์˜ค๊ณ  ์ด ๊ธ€์˜ ๊ฒฝ์šฐ 2.7.4 ๋ฒ„์ „์œผ๋กœ ์ง„ํ–‰
    
    $ rbenv global 2.7.4
    
    $ rbenv versions // *๋ฅผ ํ†ตํ•ด ํ˜„์žฌ ๋ฒ„์ „ ์ฒดํฌ ๊ฐ€๋Šฅ
    
    $ echo '# rbenv' >> ~/.bash_profile
    
    $ echo 'export PATH=~/.rbenv/bin:$PATH' >> ~/.bash_profile
    
    $ echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
    
    $ source ~/.bash_profile
    
    $ gem install bundler
    

    ์œ„์˜ ์ž‘์—…์„ ๊ฑฐ์นœ ํ›„ ๋‹ค์‹œ CocoaPods๋ฅผ ์„ค์น˜ํ•˜๋ฉด ์ •์ƒ ์„ค์น˜๊ฐ€ ๋ฉ๋‹ˆ๋‹ค.


    $ sudo gem install cocoapods

๐Ÿง‘๐Ÿปโ€๐Ÿ’ป Texture ์„ค์น˜ํ•˜๊ธฐ


  • ์ด์ œ CocoaPods๋ฅผ ์„ค์น˜ํ•˜๊ณ  ์‹ถ์€ ํ”„๋กœ์ ํŠธ์˜ ๋””๋ ‰ํ† ๋ฆฌ๋กœ ์ด๋™ํ•˜์—ฌ ์ž‘์—…์„ ์ง„ํ–‰ํ•ฉ๋‹ˆ๋‹ค.


    $ pod init

    ๐Ÿง ํ”„๋กœ์ ํŠธ๊ฐ€ ์—†๋Š” ์œ„์น˜์—์„œ pod init์„ ํ•˜๋ฉด ์•„๋ž˜์™€ ๊ฐ™์€ ๋ฉ”์„ธ์ง€๊ฐ€ ๋œน๋‹ˆ๋‹ค.


    [!] No Xcode project found, please specify one


    ํ”„๋กœ์ ํŠธ๊ฐ€ ์กด์žฌํ•˜๋Š” ์œ„์น˜์—์„œ ์ •์ƒ์ ์œผ๋กœ pod init์„ ํ•  ๊ฒฝ์šฐ ํ•ด๋‹น ์œ„์น˜์— ์•„๋ž˜ ํŒŒ์ผ์ด ์ƒ์„ฑ๋ฉ๋‹ˆ๋‹ค.


    PodFile


    ์ด์ œ ์œ„์˜ PodFile์—์„œ Texture๋ฅผ ์ถ”๊ฐ€ํ•ด์ฃผ๋Š” ์ž‘์—…์„ ํ•ฉ๋‹ˆ๋‹ค. ์šฐ์„  ์œ„์˜ PodFile์„ ์—ด๊ธฐ ์œ„ํ•ด ์ €๋Š” nano๋ฅผ ์‚ฌ์šฉํ–ˆ์Šต๋‹ˆ๋‹ค.


    $ nano Podfile

    ๊ทธ๋Ÿผ ์•„๋ž˜์™€ ๊ฐ™์€ ๋ฌธ์„œ๊ฐ€ ์—ด๋ฆฌ๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.


    # Uncomment the next line to define a global platform for your project
    # platform :ios, '9.0'
    
    target 'ํ”„๋กœ์ ํŠธ ๋ช…' do
      # Comment the next line if you don't want to use dynamic frameworks use_frameworks!
    pod 'Texture' # ์—ฌ๊ธฐ์— ์ถ”๊ฐ€!!
      # Pods for ํ”„๋กœ์ ํŠธ ๋ช…

    ์œ„์— ์ž‘์„ฑํ•œ ๊ฒƒ์ฒ˜๋Ÿผ target do ์•„๋ž˜์—


    pod 'Texture'


    ๋ฅผ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค.

    ์ž‘์„ฑ์ด ๋๋‚ฌ์œผ๋ฉด ์ €์žฅํ•˜๊ณ  ์ข…๋ฃŒ๋ฅผ ํ•ด์•ผํ•ฉ๋‹ˆ๋‹ค. ์ €๋Š” (^ + x)๋กœ ์ข…๋ฃŒํ–ˆ์Šต๋‹ˆ๋‹ค :)


    ์ด์ œ ๋งˆ๋ฌด๋ฆฌ ์ž‘์—…๋งŒ ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค. ์•„๋ž˜์˜ ๋ช…๋ น์–ด๋ฅผ ์ž…๋ ฅํ•ด์ค๋‹ˆ๋‹ค.


    $ pod install
    
    $ pod update Texture

    ์ด์ œ Texture์˜ ์„ค์น˜๋Š” ๋ฌด์‚ฌํžˆ ์™„๋ฃŒ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ์ด์ œ Texture๋ฅผ ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•ด ํ”„๋กœ์ ํŠธ์—์„œ ๊ธฐ๋ณธ์ ์ธ ์ž‘์—…์„ ํ•ด์ฃผ๋ฉด ๋ฉ๋‹ˆ๋‹ค!


โš™๏ธ Texture ์‚ฌ์šฉ์„ ์œ„ํ•œ ๊ธฐ๋ณธ ์ž‘์—…


  • ์ด์ œ ๋‹ค์‹œ Xcode๋ฅผ ์ผœ๊ณ  ํ”„๋กœ์ ํŠธ์— ๋“ค์–ด๊ฐ‘๋‹ˆ๋‹ค. ํ”„๋กœ์ ํŠธ์—์„œ ์šฐ์„  ์ž๋™์œผ๋กœ ์ƒ์„ฑ๋œ storyboard ํŒŒ์ผ์„ ์ œ๊ฑฐํ•ด์ค๋‹ˆ๋‹ค. ์ €๋Š” Main.storyboard์™€ LaunchScreen.storyboard๋ฅผ ์ œ๊ฑฐํ•ด์ฃผ์—ˆ์Šต๋‹ˆ๋‹ค.


    ๊ทธ๋ฆฌ๊ณ  Info.plist์— ๋“ค์–ด๊ฐ€์„œ Main์œผ๋กœ ๊ฒ€์ƒ‰ํ•ด์ค๋‹ˆ๋‹ค.



    ์œ„์— ๋ฐ‘์ค„ ์ณ์ง„ Storyboard Name๊ณผ Main storyboard file base name์„ ์ œ๊ฑฐํ•ด์ค๋‹ˆ๋‹ค.


    ์Šคํ† ๋ฆฌ๋ณด๋“œ๊ฐ€ ์žˆ์„ ๋•Œ์—๋Š” ์•ฑ์ด ์‹คํ–‰๋˜๋ฉด ์ฒ˜์Œ์œผ๋กœ ๋ณด์—ฌ์ค„ ViewController๊ฐ€ ์ง€์ •์ด ๋˜์—ˆ๋Š”๋ฐ, ์ง€๊ธˆ์€ ์‚ญ์ œ๋˜์—ˆ๊ธฐ ๋•Œ๋ฌธ์— SceneDelegate์—์„œ ์„ค์ •์„ ํ•ด์ค˜์•ผํ•ฉ๋‹ˆ๋‹ค.


    class SceneDelegate: UIResponder, UIWindowSceneDelegate {
    
        var window: UIWindow?
    
        func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
            // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
            // If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
            // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
            guard let windowScence = (scene as? UIWindowScene) else { return }
    
                    window = UIWindow(windowScene: windowScence)
                    window?.windowScene = windowScence
    
                    let rootViewController = HomeViewController()
                    window?.rootViewController = rootViewController
                    window?.makeKeyAndVisible()
        }
      ....

    ์œ„์™€ ๊ฐ™์ด rootViewController ์ธ์Šคํ„ด์Šค๋ฅผ ์ƒ์„ฑํ•ด์ค๋‹ˆ๋‹ค.


    ๐Ÿง ์œ„์˜ ์ž‘์—…์„ ๋ฌธ์ œ์—†์ด ์™„๋ฃŒํ–ˆ๋Š”๋ฐ import๊ฐ€ ๋˜์ง€ ์•Š๋„ค์š”?

    • ์šฐ์„  Texture๋ฅผ ์‚ฌ์šฉํ•˜๊ธฐ์œ„ํ•ด ์•„๋ž˜์™€ ๊ฐ™์ด import ํ•ด์•ผํ•ฉ๋‹ˆ๋‹ค.


      import AsyncDisplayKit

      ๊ทธ๋Ÿฐ๋ฐ ์ž๋™์™„์„ฑ์ด ์•ˆ๋ฉ๋‹ˆ๋‹ค! ๊ทธ ์ด์œ ๋Š” ๊ณต์‹ ๋ฌธ์„œ์˜ ์„ค์น˜ ๋ฉ”๋‰ด์–ผ ๋งˆ์ง€๋ง‰์— ์žˆ์Šต๋‹ˆ๋‹ค.


      Donโ€™t forget to use the workspace .xcworkspace file, not the project .xcodeproj file.


      ์ฆ‰, ํ”„๋กœ์ ํŠธ.xcodeproj ํŒŒ์ผ์„ ํ†ตํ•ด ํ”„๋กœ์ ํŠธ๋ฅผ ์—ด๋ฉด import๊ฐ€ ๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ๋‹ค์‹œ ํ”„๋กœ์ ํŠธ.xcworkspace ํŒŒ์ผ์„ ํ†ตํ•ด ํ”„๋กœ์ ํŠธ๋ฅผ ์—ด๋ฉด ์ •์ƒ์ ์œผ๋กœ import ๋˜๋Š” ๊ฒƒ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.


    ์ด์ œ ๋ณธ๊ฒฉ์ ์œผ๋กœ Texture์— ๋Œ€ํ•ด ํ•™์Šตํ•˜๊ณ , ๊ธ€์„ ๋‚จ๊ฒจ๋ณด๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค! ๐Ÿฅ•


๋ฐ˜์‘ํ˜•
๋Œ“๊ธ€
๋ฐ˜์‘ํ˜•
๊ณต์ง€์‚ฌํ•ญ
์ตœ๊ทผ์— ์˜ฌ๋ผ์˜จ ๊ธ€
์ตœ๊ทผ์— ๋‹ฌ๋ฆฐ ๋Œ“๊ธ€
Total
Today
Yesterday
๋งํฌ
TAG more
ยซ   2025/01   ยป
์ผ ์›” ํ™” ์ˆ˜ ๋ชฉ ๊ธˆ ํ† 
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
๊ธ€ ๋ณด๊ด€ํ•จ