Post

Replies

Boosts

Views

Activity

Reply to AWS Amplify Auth Issues
That means webDomain is nil. as webDomain is defined as let webDomain = infoDictionary?["WebDomain"] as? String there are several possible reasons: infoDictionary itself is nil infoDictionary has no key "WebDomain" (take care of uppercases). infoDictionary["WebDomain"] is not a String To find out, instrument code and make it more robust: print("infoDictionary", infoDictionary) print("WebDomain key value", infoDictionary?["WebDomain"]) let webDomain = infoDictionary?["WebDomain"] as? String print("webDomain", webDomain) if webDomain == nil { print("Could not initialize webDomain") return // quit initialize } let hostURL = "https://\(webDomain!)" And show exactly what you get. I assume you got the code from here: https ://github. com/aws-amplify/aws-sdk-ios/blob/main/AWSAuthSDK/Sources/AWSMobileClient/AWSMobileClient.swift If you got the solution here, don't forget to close the thread by marking this answer.
Feb ’21
Reply to Check-In Check-Out Date Picker
AFAIK, you cannot get such a behaviour in UIDatePicker. You'll have to implement your own to mimic the usual one and implement your specific range selection, built on CollectionView for instance. Have a look here to get some hints (that's a wheels picker, you'll have probably to adapt to calendar presentation) https ://swiftsenpai. com/development/expandable-date-picker-list/
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Feb ’21
Reply to How to fit the image with the tabbar in swift?
More info. this cannot be done automatically. According to : https://stackoverflow.com/questions/29708069/how-can-i-decrease-the-size-of-a-ui-tab-bar-item-image-so-that-it-fits-inside-th From Apple: doc: Unlike other custom artwork in your app, the icons and images listed in Table 41-1 must meet specific criteria so that iOS can display them properly.
Topic: Programming Languages SubTopic: Swift Tags:
Feb ’21
Reply to AWS Amplify Auth Issues
So you have to check how infoDictionary is loaded. And if you use it in a thread when it is fully loaded. Add more tests and tell what you get: let infoDictionaryMobileClient = AWSInfo.default().rootInfoDictionary["Auth"] as? [String: [String: Any]] print("infoDictionaryMobileClient", infoDictionaryMobileClient) // Is it nil ? print("Default", infoDictionaryMobileClient?["Default"]) // Does "Default" key exist ? print("OAuth", infoDictionaryMobileClient?["Default"]?["OAuth"]) // Does "OAuth"] exist ? let infoDictionary: [String: Any]? = infoDictionaryMobileClient?["Default"]?["OAuth"] as? [String: Any] print("infoDictionary", infoDictionary) If you get nothing, that means that the test is negative if self.federationProvider == .hostedUI {
Feb ’21
Reply to How Dowmload and parse an csv file in swift?
What you do typically (see http ://swiftdeveloperblog. com/code-examples/download-file-from-a-remote-url-in-swift/): override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) // Create destination URL let documentsUrl:URL = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first as URL! let destinationFileUrl = documentsUrl.appendingPathComponent("downloadedFile.jpg") //Create URL to the source file you want to download let fileURL = URL(string: "https://s3.amazonaws.com/learn-swift/IMG_0001.JPG") let sessionConfig = URLSessionConfiguration.default let session = URLSession(configuration: sessionConfig) let request = URLRequest(url:fileURL!) let task = session.downloadTask(with: request) { (tempLocalUrl, response, error) in if let tempLocalUrl = tempLocalUrl, error == nil { if let statusCode = (response as? HTTPURLResponse)?.statusCode { print("Successfully downloaded. Status code: \(statusCode)") } do { try FileManager.default.copyItem(at: tempLocalUrl, to: destinationFileUrl) } catch (let writeError) { print("Error creating a file \(destinationFileUrl) : \(writeError)") } } else { print("Error" ) } } task.resume() } Now that you have the file, you need to parse the CSV
Topic: Programming Languages SubTopic: Swift Tags:
Feb ’21
Reply to Ready to bite the bullet and migrate from Objective-C to Swift
Interesting feedback. I appreciate Swift strong type enforcement, even though I often complain when having to cast to CGFloat from a Float. I agree with you, this forum is really frustrating to say the least, with so limited capabilities. Can't you link to a SO thread ? That would be a new limitation (but I notice since a few days that my posts with links are systematically removed. I'll try to post a dummy SO reference, just to see, in another reply.
Topic: Programming Languages SubTopic: Swift Tags:
Feb ’21