| 일 | 월 | 화 | 수 | 목 | 금 | 토 | 
|---|---|---|---|---|---|---|
| 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 | 
- GIT
 - protocol
 - designPattern
 - pubspec
 - pubspec.yaml
 - OSLog
 - keyWindow
 - swiftlint
 - SwiftGen
 - dart
 - reetcode
 - COMMIT
 - ToDoRim
 - Equatable
 - Widget
 - Extentsion
 - UIAccessibility
 - github
 - algorithm
 - xcode
 - Swift
 - it
 - listview
 - Leetcode
 - IOS
 - enumerations
 - tip
 - flutter
 - toyproject
 - basic
 
- Today
 
- Total
 
목록Swift (55)
수니의 개발새발
📌 이번 글은 시간을 다른 형태로 변형하는 방법입니다. DateFormatter() extension Date { /** # formatted - Parameters: - format: 변형할 DateFormat - Note: DateFormat으로 변형한 String 반환 */ public func formatted(_ format: String) -> String { let formatter = DateFormatter() formatter.dateFormat = format formatter.timeZone = TimeZone(identifier: TimeZone.current.identifier)! return formatter.string(from: self) } } Date extension에..
📌 이번 글은 현재 시간의 밀리초를 구하는 방법입니다. timeIntervalSince1970 Int(Date().timeIntervalSince1970 / 1000.0) 현재 시간의 밀리초를 구하는 코드입니다. 👩🏻💻 사용 예제 import Foundation extension Date { /** # currentTimeInMilli - Note: 현재 시간의 밀리초 반환 */ public static func currentTimeInMilli() -> Int { return Date().timeInMilli() } /** # timeInMilli - Note: timeIntervalSince1970의 밀리초 반환 */ public func timeInMilli() -> Int { return Int..
📌 이번 글은 외부 브라우저(사파리)로 링크를 여는 방법입니다. UIApplication.shared.open() func openExternalLink(urlStr: String, _ handler:(() -> Void)? = nil) { guard let url = URL(string: urlStr) else { return } if #available(iOS 10.0, *) { UIApplication.shared.open(url, options: [:]) { (result) in handler?() } } else { UIApplication.shared.openURL(url) handler?() } } 사파리로 링크를 여는 함수입니다. 👩🏻💻 사용 예제 import UIKit class Uti..
📌 이번 글은 현재 시뮬레이터 구동 여부를 확인하는 방법입니다. SIMULATOR_DEVICE_NAME func isSimulator() -> Bool { return ProcessInfo.processInfo.environment["SIMULATOR_DEVICE_NAME"] != nil } 시뮬레이터가 구동 중이면 true를 반환하는 함수입니다. 👩🏻💻 사용 예제 import UIKit class Utils { /** # isSimulator - Returns: Bool - Note: 시뮬레이터 구동 여부 반환 */ static func isSimulator() -> Bool { return ProcessInfo.processInfo.environment["SIMULATOR_DEVICE_NAME"] ..
iOS4까지는 iOS 기기의 고유 넘버로 udid를 사용하였으나, 개인정보 문제로 iOS5부터는 udid가 사라지고 uudi(임의로 생성한 고유값)를 사용합니다. 📌 이번 글은 디바이스 고유넘버(device uuid)를 구하는 방법입니다. uuidString func getDeviceUUID() -> String { return UIDevice.current.identifierForVendor!.uuidString } 디바이스의 고유 넘버를 구하는 함수입니다. 👩🏻💻 사용 예제 import UIKit class Utils { /** # getDeviceUUID - Note: 디바이스 고유 넘버 반환 */ static func getDeviceUUID() -> String { return UIDevice..
📌 이번 글은 현재 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 라는 공통 클래스를..
화면을 그리다 보면 노치 영역으로 인해 레이아웃이 깨져 골치 아플 때가 많죠. 그래서 SafeArea Inset값이 디바이스마다 변동되어 자주 필요로 합니다. 📌 이번 글은 현재 디바이스의 SafeArea의 top.bottom 영역 값을 구하는 방법입니다. SafeArea Top Inset func safeAreaTopInset() -> CGFloat { let statusHeight = UIApplication.shared.statusBarFrame.size.height // 상태바 높이 if #available(iOS 11.0, *) { let window = UIApplication.shared.keyWindow let topPadding = window?.safeAreaInsets.top retu..
올해 초부터 종종 사이드 프로젝트로 접근성 적용 데모와 라이브러리를 만들어왔어요. 처음엔 어렵고 모르는 투성이었지만 공부하고 만들면서 지금은 굉장히 관심이 깊어졌어요. 그래서 카테고리를 따로 빼서, 접근성 적용에 대한 글들도 올려보려고 합니다. 📌 이번 글은 UIAccessibility.post(notification:argument:)을 사용하여 특정 상황에 Voice Over가 알리는 기능을 구현하는 방법입니다. 1. UIAccessibility.post(notification:argument:) Posts a notification to assistive apps. - Apple Developer Documentation Apple Developer 에서는 이 메서드가 앱에 접근성 알림을 게시해준다..