250x250
반응형
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- basic
- reetcode
- Leetcode
- COMMIT
- Extentsion
- toyproject
- UIAccessibility
- keyWindow
- tip
- Swift
- xcode
- algorithm
- Widget
- swiftlint
- github
- listview
- pubspec
- protocol
- enumerations
- GIT
- ToDoRim
- SwiftGen
- dart
- OSLog
- it
- designPattern
- IOS
- Equatable
- pubspec.yaml
- flutter
Archives
- Today
- Total
개발자 수니
[iOS/Swift] 현재 번들 버전(Bundle Version) 구하기 본문
728x90
반응형
📌 이번 글은
현재 APP의 번들 버전(Bundle Version)을 구하는 방법입니다.
CFBundleShortVersionString
Bundle.main.infoDictionary!["CFBundleShortVersionString"] as! String
현재 APP의 번들 버전을 구하는 코드입니다.
👩🏻💻 사용 예제
import UIKit
class Utils {
/**
# version
- Note: 현재 번들 버전 반환
*/
static func version() -> String {
return Bundle.main.infoDictionary!["CFBundleShortVersionString"] as! String
}
}
공통적으로 사용하는 변수 및 함수들을 Utils 라는 공통 클래스를 생성하여 관리하는 예시입니다.
Utils.version()
필요한 곳 어디서든 생성한 함수를 호출하여 사용합니다.
728x90
반응형
'iOS - Swift' 카테고리의 다른 글
[iOS/Swift] 시뮬레이터(Simulator) 구동 여부 확인하기 (0) | 2021.12.29 |
---|---|
[iOS/Swift] 디바이스 고유넘버(device uuid) 구하기 (0) | 2021.12.29 |
[iOS/Swift] 현재 디바이스 SafeArea의 top/bottom 영역 값 구하기 (0) | 2021.12.29 |
[iOS/Swift] 특정 상황에 VoiceOver 알림 등록하기 (0) | 2021.12.29 |
[iOS/Swift] iOS13 에서 라이트모드(또는 다크모드)만 지원하기 (turn off darkmode) (0) | 2021.12.29 |
Comments