Connect with Apple engineers to discuss the latest Apple technologies announced at WWDC21.

Posts under WWDC21 tag

68 Posts
Sort by:
Post not yet marked as solved
2 Replies
928 Views
Hi, We have an API that I'm trying to prototype some async await extensions for. Most of our asynchronous methods are cancelable by returning an object that implements our AGSCancelable protocol that includes a cancel() method. Here's the code I have to try to extend a geocoding method on our AGSLocatorTask class: extension AGSLocatorTask { func geocode(withSearchText text: String) async throws -> [AGSGeocodeResult] { typealias GeocodeContinuation = CheckedContinuation<[AGSGeocodeResult], Error> var cancelable: AGSCancelable? return try await withTaskCancellationHandler(handler: { cancelable?.cancel() }, operation: { return try await withCheckedThrowingContinuation({ (continuation: GeocodeContinuation) in cancelable = self.geocode(withSearchText: text) { results, error in if let error = error { continuation.resume(throwing: error) } else { continuation.resume(returning: results!) } } }) }) } } This works great, but I have to comment out the cancelable?.cancel() call or else I get a Reference to captured var 'cancelable' in concurrently-executing code static analysis error (see attached screenshot). Could someone explain how to fix this, or is this a bug in the Xcode beta? Many thanks, and thanks for a great WWDC!!
Posted
by
Post not yet marked as solved
1 Replies
710 Views
Is there a Machine Learning API that can take handwriting (either as a bitmap or as a list of points) and convert it to text? I know Scribble can be used to allow handwriting input into text fields, but in this API it is Scribble which controls the rendering of the handwriting. Is there an API where my app can render the handwriting and get information about the text content? In the Keynote demo Craig was able to get text content from a photo of a whiteboard. Are there APIs which would allow an app developer to create something similar?
Posted
by
Post not yet marked as solved
4 Replies
3.8k Views
Check the screenshot attached. That area is being used for different scenarios like: modals, navbars, etc. If you plan to add it, you need to improve your positions, for example this modal have these css properties: bottom: 0; position: fixed So if you are showing the address bar, you need to improve your position: 0 ABOVE the address bar, not behind it.
Posted
by
Post not yet marked as solved
3 Replies
1.5k Views
What is the best way to customize rendering of Markdown styles, in both UIKit and Swift? For instance, how should I tell it what font to use for normal and Bold text? This is what kept us from using NSAttributedString+HTML for embedded string formatting in the past, and AttributedString+Markdown looks even better for this use case, so I'm hoping the fact that we use a custom font won't be a roadblock. Is calling .replaceAttributes() the expected pattern, and just doing this for each expected attribute in each string?
Posted
by
Post not yet marked as solved
1 Replies
372 Views
I see in the docs that AsyncImage only takes in a URL, are there plans to expand the API to allow passing in a URLRequest, and possibly the URLSession as well? Our company's image server requires token authentication, which we pass as an HTTP header, so we're always constructing URLRequests and passing them to our custom URLSession.
Posted
by
Post not yet marked as solved
2 Replies
1.1k Views
UIKit apps can hide the Home indicator by using prefersHomeIndicatorAutoHidden in UIViewController. However, in SwiftUI apps with the SwiftUI lifecycle the root ViewController returns false for that property and there is no way to change this without changing the Root ViewController. Setting my own UIHostingViewController as root would break things like .onOpenURL for SwiftUI App Lifecycle apps. so this is not an acceptable workaround. Has anything changed in iOS 15 that makes hiding the Home indicator possible without such side effects?
Posted
by
Post not yet marked as solved
10 Replies
2.2k Views
I'm seeing an error trying to test out async let. It seems like this should work, based on the async/let and structured concurrency session videos. Here's the code: func doIt() async -> String {     let t = TimeInterval.random(in: 0.25 ... 2.0)     Thread.sleep(forTimeInterval: t)     return String("\(Double.random(in: 0...1000))") } async {     async let a = doIt()     async let b = doIt()     async let c = doIt()     async let d = doIt()     let results = await [a, b, c, d]     for result in results {         print("  \(result)")     } } But, I get this error for every "async let" statement: error: AsyncLetSwift55WWDC21.playground:12:15: error: expression is 'async' but is not marked with 'await' async let a = doIt() ^ await Am I missing something key, or is this a bug? I'm running this in the Xcode 13.0 beta, in a Playground. Thanks!!
Posted
by
Post marked as Apple Recommended
9.3k Views
Hi Team, Attempting to build our app with Xcode 13 / iOS 15, and getting a fail during archive, appearing to come from within the accelerate module. The two errors are: /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.0.sdk/usr/lib/swift/Accelerate.swiftmodule/armv7-apple-ios.swiftinterface:591:6: error: enum cases with associated values cannot be marked potentially unavailable with '@available'   @available(macOS 12.0, iOS 15.0, tvOS 15.0, watchOS 8.0, *)    ^ in a number of places, and the following one, once: /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.0.sdk/usr/lib/swift/Accelerate.swiftmodule/armv7-apple-ios.swiftinterface:1:1: error: failed to build module 'Accelerate'; this SDK is not supported by the compiler (the SDK is built with 'Apple Swift version 5.5 (swiftlang-1300.0.17.216 clang-1300.0.18.1)', while this compiler is 'Apple Swift version 5.5 (swiftlang-1300.0.19.104 clang-1300.0.18.4)'). Please select a toolchain which matches the SDK. // swift-interface-format-version: 1.0 ^ This is Version 13.0 beta (13A5154h), doing a release build archive (dev build/run succeeds if that helps). Any insights into whats going on would be great? Cheers.
Posted
by
Post marked as solved
18 Replies
65k Views
Hi, When I run the following code in application(_ :didFinishLaunchingWithOptions) in iOS 15, the bar color turns transparent (thus, showing the black background underneath), while the same code works fine in iOS 14.5: UINavigationBar.appearance().isTranslucent = false UINavigationBar.appearance().barTintColor = .red Here's the screenshots of Simulators running iOS 14.5 and iOS 15: I'm using Xcode 13 on macOS Big Sur 11.4. Thanks!
Posted
by
Post not yet marked as solved
3 Replies
1.6k Views
In the Meet AsyncSequence talk, there's a very cool use case that's shown in one of the slides - the new notifications property on NotificationCenter is an async sequence and the code sample does something like: let notification = await center.notifications(named: ....).first { ... } This seems really intriguing and useful to me but I had a few questions about the details of how this works: What is the type of notification in this snippet? A Task? Where would I store this value? What context should this be invoked in, especially if I want to have a long-running notification filter running that will remain active for the lifetime of the app? Basically, I'm curious to see an example of the code surrounding this snippet.
Posted
by
Post marked as Apple Recommended
4.3k Views
I am testing iOS15 and some new functionalities of UIKit. I've encountered some issues, not sure how to solve them. I did not change that code. This is just a piece of code that worked perfectly with the iOS 14, now after updating my target, it throws an error. Xcode crashes the moment when my custom header for the UICollectionView of type UICollectionElementKindSectionHeader is being returned for the dataSource. Here is my code: private func configureDataSource() { dataSource = UICollectionViewDiffableDataSource<Section, Follower>(collectionView: collectionView, cellProvider: { (collectionView, indexPath, followers) -> UICollectionViewCell? in let cell = collectionView.dequeueReusableCell(withReuseIdentifier: FollowerCell.reuseId, for: indexPath) as! FollowerCell cell.set(on: followers) return cell }) dataSource.supplementaryViewProvider = { (collectionView, kind, indexPath) in let header = collectionView.dequeueReusableSupplementaryView(ofKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: FollowersCollectionHeaderView.reuseId, for: indexPath) as! FollowersCollectionHeaderView header.set(with: self.user) return header } } The log says: the view returned from -collectionView:viewForSupplementaryElementOfKind:atIndexPath: does not match the element kind it is being used for. When asked for a view of element kind 'FollowersCollectionHeaderView' the data source dequeued a view registered for the element kind 'UICollectionElementKindSectionHeader'. I did cast UICollectionElementKindSectionHeader to FollowersCollectionHeaderView, therefore I am not sure what is the issue here. I've watched WWDC21 what's new in UIKit but haven't seen any mentioning of any change for that particular code. Any suggestions, what to fix in that code?
Posted
by
Post not yet marked as solved
1 Replies
593 Views
The operation couldn’t be completed. (com.apple.ShazamKit error 300.) I get this error when I try to add multiple shazamcatalogs on a single SHCustomCatalog. The fact that the operation is called add(from:) and not 'load' lets me suggest that it's meant to use that way. Am I wrong? And yes, both work work if I just add one at a time. let catalog = SHCustomCatalog() do { try catalog.add(from: url1) try catalog.add(from: url2) {...} } catch {...} . . Also, fun fact: I was working on a ShazamKit myself before dubDub and it's a really fascinating topic and so awesome to see how well it works, great job! 👏
Post not yet marked as solved
3 Replies
1.7k Views
How do we get the appropriate profile to enable Matter support in the developer preview build of iOS 15? The talk mentions that this is required, but I'm not sure where to acquire the profile.
Posted
by
Post marked as solved
1 Replies
6.4k Views
Hello. I was wondering if there is any way to manually set the Safari 15 tab color-theme color to my website. It seems like Safari automatically choose the color but I find out that this selection occurs during the first seconds of website load and, because of that, the color being choosen is not the right one for my website. Is there any CSS I could add or a metatag that tells safari which color it should pick? I know this is kinda a wierd request, but I want to provide my visitors the richest experience they could get. Thank you.
Posted
by
Post not yet marked as solved
1 Replies
754 Views
let setupManager = HMAccessorySetupManager() let homeTopology = HMCHIPServiceTopology(homes: homes) setupManager.addAndSetUpAccessories(for: homeTopology, completionHandler: { error in if let error = error { print(error) } }) when calling the function 'setupManager.addAndSetUpAccessories(for: homeTopology)', an error log occurs. Error Domain=HMErrorDomain Code=48 "Operation is not supported." UserInfo={NSLocalizedDescription=Operation is not supported.} Any ideas what could cause this? Is this function not working yet because it is currently beta? Or, did i use the function wrong?
Posted
by
Post not yet marked as solved
2 Replies
1.1k Views
I'm trying to build my app SolarWatch on Xcode Cloud. The setup was amazing. Everything setup and ready to go within 5 minutes. But my builds fail consistently where Xcode Cloud errors out when running the following build step and results in the attached error log screenshot. Tried both with release and beta environments. Any help appreciated. Run command: 'source /Volumes/Task/ci_build.env && source /Volumes/Task/ci_plan.env && xcodebuild archive -workspace /Volumes/workspace/repository/SolarWatch.xcworkspace -scheme SolarWatch -destination generic/platform=iOS -archivePath /Volumes/workspace/build.xcarchive -derivedDataPath /Volumes/workspace/DerivedData -resultBundleVersion 3 -resultBundlePath /Volumes/workspace/resultbundle.xcresult -resultStreamPath /tmp/resultBundleStream3a2d7024-571e-4e16-969d-5b570b91d2a8.json -IDEPostProgressNotifications=YES CODE_SIGN_IDENTITY=- AD_HOC_CODE_SIGNING_ALLOWED=YES COMPILER_INDEX_STORE_ENABLE=NO -hideShellScriptEnvironment'
Posted
by
Post not yet marked as solved
2 Replies
545 Views
As per the document, the following conditions should be met in order to retrieve network info: The app uses Core Location, and has the user’s authorization to use location information. The app uses the NEHotspotConfiguration API to configure the current Wi-Fi network. The app has an active VPN configuration installed. The app has an active NEDNSSettingsManager configuration installed. In our case, the application relies on point 3 i.e installed VPN profile. But, I observed that CNCopyCurrentNetworkInfo always returns null even though a VPN profile is configured. This works fine with iOS 14.x versions. I also tried using fetchCurrentWithCompletionHandler API. But, ended up with the same result. Any help/lead would be highly appreciated. Thanks in advance.
Posted
by