I'm trying to figure out what the actual logic to navigate my App's screens is (I know the video says we shouldn't use it for that - this is just an exercise) using intents, but the lack of the Navigator implementation is a show-stopper. Can someone kindly share what the implementation for it looks like?
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I'm trying to use (NS)Measurement to convert any higher unit into kilobytes.
let mes = Measurement(value: 3, unit: UnitInformationStorage.megabytes)
let kilobytes = mes.converted(to: .kilobytes).value
I expect kilobytes to be 3072, but instead I get 3000.
I get that in computing we often do rounding and for many people 1000 kilobytes = 1MB when in reality it should be 1024 kilobytes = 1MB. Is there any way to change this behavior?
I have been trying to work with the image downloader code provided in the session to see if I could download two images at once and cache them in the actor.
For some reason, when I enter the download method on the actor with two consecutive async let calls, the app hangs at the deepest suspension point.
I am providing a very minimum code you can copy and paste into a new iOS Storyboard-based project, replacing the code in ViewController.swift:
enum ImageDownloadError: Error {
case badImage
}
actor ImageDownloader {
private var cache: [URL: UIImage] = [:]
func image(from url: URL) async throws -> UIImage {
if let image = cache[url] {
return image
}
print("Downloading image")
let image = try await downloadImage(url: url)
print("Downloaded image")
cache[url] = image
return image
}
private func downloadImage(url: URL) async throws -> UIImage {
let imageRequest = URLRequest(url: url)
let (data, imageResponse) = try await URLSession.shared.data(for: imageRequest)
guard let image = UIImage(data: data), (imageResponse as? HTTPURLResponse)?.statusCode == 200 else {
throw ImageDownloadError.badImage
}
return image
}
}
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
async {
await downloadImages()
}
}
func downloadImages() async {
let downloader = ImageDownloader()
let imageURL = URL(string: "https://www.andyibanez.com/fairesepages.github.io/tutorials/async-await/part3/3.png")!
async let downloadedImage = downloader.image(from: imageURL)
//async let sameDownloadedImage = downloader.image(from: imageURL) // Uncomment to see the bug
var images = [UIImage?]()
images += [try? await downloadedImage]
//images += [try? await sameDownloadedImage]
print("Finished everything")
}
}
If you uncomment the code marked as Uncomment to see the bug, you will see that the code will go through many different await calls, but it will hang on the ine in the URLSession.shared.data(for: imageRequest) call. The app just hangs there and doesn't continue executing. Commenting the same line will let it work fine.
Are there any known workarounds for this? I would love to get this to work.
I have opened a feedback on this, linking it just in case
FB9213145
I have a few web browsers on my phone (Firefox, Chrome) and none of them can currently be set as default web browsers on iOS 14. I am assuming that there needs to be some work done in the app in order for the system to consider it a web browser and show in the list of browsers you can set as default.
I am also assuming that the web browser needs to comply with some sort of minimum functionality in order to work as a default.
I have been looking for a while for the documentation for this, and I haven't had any luck. What do I need to be able to set an app as a default web browser? A plist? Conform to a protocol? Anything else? Any points to the documentation will be appreciated as I cannot seem to find it on my own.
I have quite a lot of feedback to send regarding iOS 9.3, but the feedback app says I'm not enrolled in any beta program. I downloaded the config profile from the member center directly with the very same account I'm trying to log with into the Feedback Center app and OTA'd my phone/So I'm using everything "officially" provided by Apple by the feedback center says I'm not authorized anyway.What should I do? Should I open standard radars like always? The Feedback app makes it much nicer and easier to send feedback I'd prefer to use it, but if it thinks I'm not authorized...