I develop an App which has a quicklook preview for files located on a web server
To realize this preview, I download the file and access it with a QLPreviewController
When I use simulator, I can see the downloaded files somewhere in library/developper/coresimulator..... and so on of my mac, and I can manually delete them. But if I search these files on the IPhone simulator, I can't find them.
What when I run the application on my real device? How will I be able to delete these files? because I think it take place in the IPhone
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
For some programming reason, I need to know the real size (width and height) of an UIView wich has constraints.
Depending on the device I use, and depending on the orientation of the device, the width or height of my view change, but frame and layer frame don't give me the correct result.
Is there a mean to have the size?
I'm complety lost with async await operation
I have a subclass of UITextField which provide a verif method
in the resignFirstResponder method, I call the verif Method and return true or false, depending of the result of the verif
the verif method is asynchrone, because it can make call to a web server.
My code is:
import UIKit
public enum VerifResult<S: NSString> {
case success
case failure(S)
}
@IBDesignable class TextField: UITextField {
@IBInspectable var obligatoire: Bool = false
override func resignFirstResponder() -> Bool {
var bRes = false
do {
let res = try await withCheckedThrowingContinuation {
continuation in
let result = try await verif()
continuation.resume(returning: result)
}
switch res {
case .success: bRes = true
case .failure(let msg): bRes = false
}
} catch {
return false
}
return bRes
}
public func verif() async throws -> VerifResult<NSString> {
if obligatoire && text == "" {
return .failure("Zone obligatoire")
} else {
// make call to a webserver and return .sucess or .failure
return .success
}
}
}
in the resignFirstResponder on the line try await, the compiler detects the error:
Invalid conversion from throwing function of type '(CheckedContinuation<_, Error>) async throws -> Void' to non-throwing function type '(CheckedContinuation<T, Error>) -> Void'
I'm lost, I don't understand why
where is my mistake?