[iOS] Swift 라이브러리 typing animation

2021. 8. 23. 16:50·iOS/Swift

첫번째 방법

단순 코드로 구현하는 방법이다. 

import UIKit

class WelcomeViewController: UIViewController {

    @IBOutlet weak var titleLabel: UILabel!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        titleLabel.text = ""
        var charIndex = 0.0
        let titleText = "⚡️FlashChat"
        for letter in titleText {
            Timer.scheduledTimer(withTimeInterval: 0.1 * charIndex, repeats: false) { timer in
                self.titleLabel.text?.append(letter)
            }
            charIndex += 1
        }
       
    }

}

 

두번째 방법

CocoaPods를 이용하는 방법이다.

더보기

https://cocoapods.org/

 

CocoaPods.org

CocoaPods is built with Ruby and is installable with the default Ruby available on macOS. We recommend you use the default ruby. Using the default Ruby install can require you to use sudo when installing gems. Further installation instructions are in the g

cocoapods.org

 

 

cocoapod 설치방법

//step 1
sudo gem install cocoapods

//step 2
pod setup --verbose

//설치되었는지 확인
pod --version
//step 1 작업중인 디렉토리로 이동
cd 본인이 작업중인 디렉토리 경로  //예시 : cd /Users/gildong/ios/example

//step 2
pod init

//step 3
podfile을 xcode로 열어준다.

<열린 podfile>

더보기

https://cocoapods.org/pods/CLTypingLabel

 

CLTypingLabel

UILabel with character by character typing animation in swift iOS/OSX

cocoapods.org

 

<수정된 podfile>

platform :ios, '9.0'

target 'Flash Chat iOS13' do
  use_frameworks!

  # Pods for Flash Chat iOS13
  
    pod 'CLTypingLabel' 
    
end

사이트에 나와있듯 pod 'CLTypingLabel' 을 추가해준다. 

 

pod install

흰색 xcworkspace 파일이 만들어지는데 이걸로 들어간다.

 

 

 

 

'iOS > Swift' 카테고리의 다른 글

[iOS/Swift] 카메라로 동영상 촬영하기  (0) 2022.05.21
[iOS] Charts 라이브러리 설치방법 및 사용방법  (0) 2022.03.03
[iOS/Swift] Xcode Simulator 키보드 안보일때  (0) 2021.05.08
[iOS/Swift] Custom font 적용하기  (0) 2021.04.20
[iOS/Swift] 주사위 프로젝트 - Dicee (3) : Auto Layout  (0) 2021.02.26
'iOS/Swift' 카테고리의 다른 글
  • [iOS/Swift] 카메라로 동영상 촬영하기
  • [iOS] Charts 라이브러리 설치방법 및 사용방법
  • [iOS/Swift] Xcode Simulator 키보드 안보일때
  • [iOS/Swift] Custom font 적용하기
🥭Mango
🥭Mango
  • 🥭Mango
    AppleMango🥭
    🥭Mango
  • 전체
    오늘
    어제
    • 분류 전체보기
      • iOS
        • Swift
        • SwiftUI
        • RxSwift
      • Algorithm
        • C
        • Python
        • Swift
      • Computer Science
        • 컴퓨터 네트워크
        • OS
      • ...
      • 개발 타임캡슐
        • Python
        • Flutter
        • Android
        • Kotlin
        • Java
  • 블로그 메뉴

    • 홈
    • 태그
    • 방명록
  • 링크

  • 공지사항

  • 인기 글

  • 태그

    14503 파이썬
    파이썬 1459
    MapMarker
    백준 소수
    파이썬
    swiftUI tabview
    IOS
    6118
    파이썬 토마토
    1613 역사
    1차원 뿌요뿌요
    파이썬 14503
    Custom Map Marker
    typing animation
    코틀린 상속
    SwiftUI Apple Login
    14503 로봇청소기
    코틀린
    파이썬 정렬
    스택
    Apple Login
    Swift Hello World!
    토마토
    swiftUI Gradients
    역사 파이썬
    SwiftUI
    파이썬 6118
    백준 토마토
    Code Base
    1613 파이썬
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.2
🥭Mango
[iOS] Swift 라이브러리 typing animation
상단으로

티스토리툴바