본문 바로가기

개발/IOS

Swift - Alamofire - REST API pod 'Alamofire', '~> 5.5' pod 'SwiftyJSON', '~> 4.0' GET private func requestGet(url:String, completion:@escaping (APIResult)->Void) { self.request = AF.request(url, method:.get, encoding: JSONEncoding.default) self.request?.validate(statusCode: 200..Void) { print("\n\n") print("REQUEST POST") print(url) self.request = AF.request(url, method:.post, parameters: params, encoding: JSONEncoding.defa.. 더보기
키보드 올라올때 화면 대응하기 pod 'IQKeyboardManagerSwift' https://github.com/hackiftekhar/IQKeyboardManager GitHub - hackiftekhar/IQKeyboardManager: Codeless drop-in universal library allows to prevent issues of keyboard sliding up and Codeless drop-in universal library allows to prevent issues of keyboard sliding up and cover UITextField/UITextView. Neither need to write any code nor any setup required and much more. - Git.. 더보기
Swift IOS 앨범 권한 import Photos switch PHPhotoLibrary.authorizationStatus() { case .authorized: print(".authorized") self.fetchAll() case .denied: print(".denied") permissionView.isHidden = false case .notDetermined: PHPhotoLibrary.requestAuthorization({ switch $0 { case .authorized: print("notDetermined .requestAuthorization") DispatchQueue.main.async { self.fetchAll() } case .denied: print("notDetermined .denie.. 더보기
ios swift get app version var version: String? { guard let dictionary = Bundle.main.infoDictionary, let version = dictionary["CFBundleShortVersionString"] as? String, let build = dictionary["CFBundleVersion"] as? String else {return nil} let versionAndBuild: String = "vserion: \(version), build: \(build)" return versionAndBuild } 더보기
[IOS] Swift 서버 이미지 업로드 Set Pod pod 'Alamofire', '~> 5.0.0-rc.3' Upload Image(Swift) let url = "fileupload url" let image = UIImage(named: "Image") let imgData = image!.jpegData(compressionQuality: 0.2)! AF.upload(multipartFormData: { multipartFormData in multipartFormData.append(Data("value".utf8), withName: "key") multipartFormData.append(imgData, withName: "key",fileName: "a.jpg", mimeType: "image/jpg") }, to: url)... 더보기