🍏(115)
-
[Swift] Ascii to String / String to Ascii / 아스키코드 변환 / 아스키 값 변환 / 아스키 / ASCII
// String to Ascii let ch = "C" let asciiIntValue_C = Int(UnicodeScalar(ch)!.value) let asciiIntValue_A = Int(UnicodeScalar("A").value) // 0x41, 65(d) // Ascii Int Value to String let result = String(UnicodeScalar(asciiIntValue_A)!) print(asciiIntValue_C) print(asciiIntValue_A) print(result)
2022.07.12 -
[Swift] 배열에 모든 배열이 포함되는지 확인 하는 법.
배열을 Set로 만들어 준 뒤 isSuperset(of: any) 사용. * 주의 할 점 Set로 만들어 진 시점에서 중복되는 값 사라짐 var ch = ["c","h","a","n","a"] var an = ["a","n"] var hi = ["h","i"] print(Set(ch).isSuperset(of: an))// a,n 전부 포함 true print(Set(ch).isSuperset(of: hi))// h만 포함 false print(Set(ch)) print(ch) Apple Developer Documentation developer.apple.com
2022.07.01 -
[Swift] 함수간 걸린시간 측정 / 실행 시간 / 코드 실행 시간 측정
Foundation 내장 함수인 CFAbsoluteTimeGetCurrent() 활용. TimeInterval로 return시 CFAbsoluteTime 반환보다 적은 시간이 나오는 것을 확인. import Foundation public func progressTime(_ closure: () -> ()) -> TimeInterval { let start = CFAbsoluteTimeGetCurrent() closure() let diff = CFAbsoluteTimeGetCurrent() - start return (diff) } progressTime { // put your func } 예시) import Foundation public func progressTime(_ closure: () -..
2022.06.14 -
[Firebase] cocoaPod을 사용한 remoteConfig 연결 / splash / Firebase/RemoteConfig
개발 환경 : - macOS Monterey 12.3.1 - Xcode 13.3.1 - Firebase Version 9.0.0 pod init 후 작성 # Uncomment the next line to define a global platform for your project # platform :ios, '9.0' target 'Chat' do # Comment the next line if you don't want to use dynamic frameworks use_frameworks! # Pods for Chat pod 'SnapKit', '~> 5.6.0' # Add the pods for the Firebase products you want to use in your app # For ..
2022.05.10 -
[Xcode] ImageLiteral() / ios 이미지 코드에 등록 / ios image code / ios 글자를 이미지 처럼 / 코드에 image
개발 환경 : - macOS Monterey 12.3.1 - Xcode 13.3.1 #imageLiteral()
2022.05.10