I'm trying to do a simple application in SwiftUI taking advantage of SwiftUI 2.0's new multiplatform project template, and I wish to add the option to collapse the sidebar as many other apps do.
I've got an extremely simple sidebar I did following the Fruta example project, and I tried adding a boolean state variable that controls whether the sidebar should show or not, but that doesn't work because when the sidebar is hidden, the main view is turned translucent.
On iPadOS, a button appears on top of the sidebar that allows to collapse it. How would I do this in macOS? Is there a way to natively achieve this in SwiftUI, or I'll need to resort to a UIKit workaround?
Please note I'm using macOS Big Sur, Xcode 12, and SwiftUI 2.0
Thanks in advance.
Post
Replies
Boosts
Views
Activity
Hello World. My team and I are developing a Mastodon client in SwiftUI, and we're using a third-party UIKit library called Atributika for converting HTML content into NSAttributedStrings that we then display as posts.
Until Wednesday, everything was fine. Everything compiled without any problem. We're almost done with this app, but since we updated to Xcode beta3, we can't test our changes because the compilation will fail with the following error:
Command CompileSwift failed with a nonzero exit code:
Could not find module 'Atributika' for target 'arm64-apple-ios-simulator'; found: x86_64-apple-ios-simulator, x86_64
I guess this is caused by Xcode beta 3 now being combined with the new Universal Xcode thingy that was previously bundled as a different download, since it's trying to compile it for the arm64 iOS simulator.
Yesterday we found out that you can compile to a physical device without any problem, so we can at least test our changes, but it's still really annoying since we can't use the new Previews, nor the simulator. We can't even use the On-device previews, so we spend a lot of time in compiling the apps and then installing them on our devices.
Is there any way we can fix this? Changing VALID_ARCHS to arm64 arm64e i386 x86_64 doesn't work.
Thanks in advance. :D
Hello World. My team and I are developing a mastodon client in SwiftUI, and would like to allow users to interact with posts by swiping to the left or to the right.
The last question regarding this topic was asked 11 months ago, saying it wasn't available yet, but I guess the situation must have changed with all the new stuff in SwiftUI 2.0
Is there any way to achieve this?
Thanks in advance
My team and I are currently developing a Mastodon client in SwiftUI and I've got a simple StatusView where I display all the post data.
This view, known on my project as StatusView, has two NavigationLinks: The main one, that redirects the user to the post's thread, and one that redirects the user to the post's author's profile when the post's profile picture is tapped.
Until here, everything works fine. If you tap anywhere on the post that aren't the buttons (like, boost, and share) or the profile picture, it opens the thread. If you tap on the profile picture, it opens the author's profile.
But if you tap below the profile picture, the app crashes, only giving me the following error:
2020-08-23 21:32:39.929392-0400 Hyperspace[830:147862] WF: _WebFilterIsActive returning: NO
2020-08-23 21:32:40.117865-0400 Hyperspace[830:147862] [assertion] Error acquiring assertion: <Error Domain=RBSAssertionErrorDomain Code=2 "Specified target process does not exist" UserInfo={NSLocalizedFailureReason=Specified target process does not exist}>
2020-08-23 21:32:40.117994-0400 Hyperspace[830:147862] [ProcessSuspension] 0x11decfa80 - ProcessAssertion: Failed to acquire RBS Background assertion 'WebProcess Background Assertion' for process with PID 837, error: Error Domain=RBSAssertionErrorDomain Code=2 "Specified target process does not exist" UserInfo={NSLocalizedFailureReason=Specified target process does not exist}
2020-08-23 21:32:40.119401-0400 Hyperspace[830:147862] [assertion] Error acquiring assertion: <Error Domain=RBSAssertionErrorDomain Code=2 "Specified target process does not exist" UserInfo={NSLocalizedFailureReason=Specified target process does not exist}>
2020-08-23 21:32:40.119549-0400 Hyperspace[830:147862] [ProcessSuspension] 0x11decfac0 - ProcessAssertion: Failed to acquire RBS Suspended assertion 'WebProcess Suspended Assertion' for process with PID 837, error: Error Domain=RBSAssertionErrorDomain Code=2 "Specified target process does not exist" UserInfo={NSLocalizedFailureReason=Specified target process does not exist}
Fatal error: UIKitNavigationBridge: multiple active destinations: file SwiftUI, line 0
2020-08-23 21:32:40.292135-0400 Hyperspace[830:147862] Fatal error: UIKitNavigationBridge: multiple active destinations: file SwiftUI, line 0
I guess this is because when you tap there, both the thread's and the profile's navigation links are triggered, causing the app to crash because there are multiple active destinations, as it's trying to go to the thread and to the profile at the same time.
TL;DR
My app crashes because two NavigationLinks are triggered at the same time when they shouldn't.
How can I fix this?
Thanks in Advance.
My Code
My Code - https://developer.apple.com/forums/content/attachment/97a69433-ae8d-4aa7-9921-2ceba4d3eb4c