I have an SwiftUI iOS app that uses TabView to display 4 different NavigationStacks. Each stack can be navigated into.
To make this app work better on iPad OS I'd like to use a NavigationSplitView with a sidebar and a detail view. The sidebar contains a menu with the 4 items that are tabs on iOS. The detail view should contain individual NavigationStacks that should retain their view paths.
After having played around with it a bit it seems to me that NavigationSplitView is not meant to be used that way. The detail view resets every time I select another menu item in the sidebar. I've tried retaining the individual navigation paths (as @States) in my root view and passing them into the individual NavigationStack when creating the detail view. However, it seems like NavigationSplitView is resetting the path whenever you switch to another menu item.
Has anybody figured this out?
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Hey guys,
I saw that both the Mona (Mastodon client) and the Telegram app offer translations on post through the click of a button. They both offer to select "Apple Translate" as a translation service. Both apps are available through the App Store.
I'm wondering how they're doing it :) I couldn't find an official, public API to tap into the LTUITranslationViewController they're presenting. On the other hand they've both run through the app review process and using private APIs should have thrown a red flag.
I thought that they may have setup a custom shortcut through which they trigger the Apple Translate app, but there are no shortcuts by these apps in the Shortcuts app.
This is what shows up when you hit the "Translate" button on a post:
Hey guys,
I converted a T5-base (encoder/decoder) model to a CoreML model using https://github.com/huggingface/exporters (which are using coremltools under the hood). When creating a performance report for the decoder model within XCode it shows that all compute units are mapped to the CPU. This is also the experience I have when profiling the model (GPU and ANE are not used).
I was under the impression that CoreML would divide up the layers and run those that can run on the GPU / ANE, but maybe I misunderstood.
Is there anything I can do to get this to not run on the CPU exclusively?
Hey guys,
I have an NSAttributedString within my app (created from HTML). I assign this string to a UITextView.
I would like certain parts of that text to be marked with an 'header' accessibility trait (all the headlines in that text) so that voice over can identify them properly.
I was under the impression that I can just use accessibilityTextHeadingLevel to do so, but the text in that given range is still setup with the 'text' accessibility trait:
var myString = NSMutableAttributedString(...)
let range = NSRange(location: 0, length: 44) myString.addAttribute(NSAttributedString.Key.accessibilityTextHeadingLevel, value: 1, range: range)
How is accessibilityTextHeadingLevel supposed to work?
Hey guys,
I'm having a performance problem with SwiftUI. In my main view I have a typical ScrollView with a VStack that contains rows of scrollable HStacks (pretty much like the 'For you' screen of the Photos app).
When the user clicks on one of the items displayed in the stacks a sheet should open. However, opening the sheet takes 2-3 seconds.
I have already run the app through instruments and there is no immediate performance issue within my code: no new views are created within the 'View Body' row (except the one view used in the .sheet)
nothing in TimeProfile - all the heavy, time-consuming stuff shows to be system libraries
The CoreAnimation Commits row shows a lot of activity in AG::Subgraph::update
within the "View Properties" row I can also see a lot of activity within my main view (e.g. lots of calls like 'IdentityLink in SystmeContextMenuContainer updated from ...') starting the moment I try to open the .sheet. It seems like there is some hardcore CoreAnimation going on in the background - is this due to the fact that the main view is scaled down a little and animated to the background when showing a modal dialogue on iOS? However, I would expect iOS to just take a snapshot of the main view and not run through the entire rendering graph.
Two additional things I noticed: I get some performance improvements when I remove a .contextMenu ViewModifier I created and which I add to each item in the list.
when using iOS14's .fullScreenCover instead of .sheet the modal opens without any delay