๋ฐ์ํ
UIDevice
- current ์ธ์คํด์ค๋ก ํ์ฌ ๊ธฐ๊ธฐ์ ์ ๋ณด๋ฅผ ๊ฐ์ ธ ์ฌ ์ ์์
- ์ด๋ฆ, ๊ธฐ๊ธฐ ๋ชจ๋ธ, ์ด์์ฒด์ ์ด๋ฆ๊ณผ ๋ฒ์ ๋ฑ์ ์ ๋ณด๋ฅผ ์ป์ ๋ ์ฌ์ฉํจ
- ๋ฌผ๋ฆฌ์ ๋ฐฉํฅ(๊ธฐ๊ธฐ๋ฅผ ๊ฐ๋ก, ์ธ๋ก๋ก ๋๋ ๊ฒ)๊ณผ ๊ฐ์ ๊ธฐ๊ธฐ์ ์ํ ๊ฐ์ ๋ณํ๋ฅผ ์ถ์ ํ๋๋ฐ ์ฌ์ฉํ ์ ์์
- ๋ฒ ํฐ๋ฆฌ ์ํ์ ๋ํ ์ ๋ณด์ ๊ทธ ๋ณํ๋ฅผ ์ถ์ ํ ์ ์์
- ์ฌ์ฉ์๊ฐ ๊ธฐ๊ธฐ๋ฅผ ์ก๊ณ ์ผ๊ตด์ ๊ฐ๊น์ด ๊ฐ์ ธ๊ฐ๋์ง๋ฅผ ํ์ธ ํ ์ ์๋ ๊ทผ์ ์ผ์์ ๋ํ ์ ๋ณด๋ฅผ ์ ๊ณตํจ
import UIKit
class DeviceInfo {
static var sharedObject: DeviceInfo = DeviceInfo()
/// Device Name (e.g. "iPhone 14 Pro")
public func getDeviceName() -> String? {
return UIDevice.current.name
}
/// System Name (e.g. "iOS")
public func getSystemName() -> String? {
return UIDevice.current.systemName
}
/// System OS Version (e.g. "4.0")
public func getSystemVersion() -> String? {
return UIDevice.current.systemVersion
}
/// Model (e.g. "iPhone", "iPod touch")
public func getDeviceModel() -> String? {
return UIDevice.current.model
}
/// UUID
public func getUUID() -> String? {
return UIDevice.current.identifierForVendor?.uuidString
}
}
๊นํ๋ธ ์ฝ๋ ์ฃผ์ :
https://github.com/youabledev/archive/blob/main/Archive/Basic%20Setting/DeviceInfo.swift
์ฐธ๊ณ ์ฌ์ดํธ ๋ฐ ๋์
728x90
๋ฐ์ํ
'๐ iOS' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[iOS/Swift] Localization ์ฝ๋๋ก ๋ค๊ตญ์ด ์ฒ๋ฆฌ (0) | 2023.02.23 |
---|---|
[iOS/Swift] SafeArea ๋์ด ๊ตฌํ๊ธฐ (0) | 2023.02.05 |
[iOS/Swift] infoDictionary ์ฑ ๋ฒ์ , ๋ฒ๋ค ์์ด๋ ๊ฐ์ ธ์ค๊ธฐ (0) | 2023.02.04 |
[iOS/Swift] ์ฑ๊ธํค ๊ฐ์ฒด ์์ฑ Singleton (0) | 2023.02.04 |
[iOS/Swift] UIPresentationController (0) | 2023.01.29 |
๋๊ธ