Post

Replies

Boosts

Views

Activity

View pops automatically when in navigation view
I want to have a navigation view with 3 views where the third view need to pop to the root view when button is clicked.Here is the code I'm implementing: import SwiftUI class NavigationHelper: ObservableObject { @Published var selection:String? = nil } struct View1: View { @ObservedObject var navigationHelper:NavigationHelper = NavigationHelper() var body: some View { NavigationView{ VStack { Text("View1") .padding() Button { navigationHelper.selection = "View2" } label: { Text("Go To View2") } NavigationLink(tag: "View2", selection: $navigationHelper.selection) { View2() } label: { EmptyView() }.isDetailLink(false) } }.environmentObject(navigationHelper) } } struct View2: View { @EnvironmentObject var navigationHelper:NavigationHelper var body: some View { VStack { Text("View2") .padding() Button { navigationHelper.selection = "View3" } label: { Text("Go To View3") } NavigationLink(tag: "View3", selection: $navigationHelper.selection) { View3() } label: { EmptyView() } } } } struct View3: View { @EnvironmentObject var navigationHelper:NavigationHelper var body: some View { VStack { Text("View3") .padding() Button { navigationHelper.selection = nil } label: { Text("Go To Root") } } } } When View3 is opened it pops back to View1 when opened and cannot understand why? For some reason the selection property becomes nil maybe.
3
0
674
Nov ’21
Swift Package Manager's binaryTarget with local XCFramework crashes Xcode
Hello, I've create a sample Swift package which uses binaryTarget to add local XCFramework dependency to a package. XCFramework itself contain two static libraries: One for iOS simulator, and one for iOS device. The result is that Xcode 13 crashes, and when build from command line there is an error, that doesn't help much. Here is sample project download site: https://drive.google.com/file/d/1SBw77DwUOlF40EEXEJQr3i9M-afAm4lv/view?usp=sharing Here is the result when building from command line: swift build -Xswiftc "-sdk" -Xswiftc "`xcrun --sdk iphonesimulator --show-sdk-path`" -Xswiftc "-target" -Xswiftc "x86_64-apple-ios15.0-simulator" -v /usr/bin/xcrun --sdk macosx --show-sdk-platform-path /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc -print-target-info /usr/bin/xcrun --sdk macosx --find xctest /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc -print-target-info /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend -frontend -print-target-info -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend -frontend -print-target-info /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend -frontend -emit-supported-features /var/folders/65/b8ghmm157gn3c_m8cnmxbx2r0000gn/T/TemporaryDirectory.WtlPlf/dummyInput-1.swift Illegal instruction: 4 Here is stack trace from Xcode: Process: Xcode [3774] Path: /Applications/Xcode.app/Contents/MacOS/Xcode Identifier: com.apple.dt.Xcode Version: 13.0 (19234) Build Info: IDEFrameworks-19234000000000000~16 (13A233) App Item ID: 497799835 App External ID: 844005016 Code Type: X86-64 (Native) Parent Process: ??? [1] Responsible: Xcode [3774] User ID: 501 Date/Time: 2021-10-14 17:43:33.627 +0300 OS Version: macOS 11.6 (20G165) Report Version: 12 Bridge OS Version: 5.5 (18P4759a) Anonymous UUID: 5B874F5B-A18E-16E7-3084-2A0B79B218C4 Time Awake Since Boot: 7600 seconds System Integrity Protection: enabled Crashed Thread: 5 Dispatch queue: -[IDEExecutionEnvironment initWithWorkspaceArena:] (QOS: UNSPECIFIED) Exception Type: EXC_BAD_INSTRUCTION (SIGILL) Exception Codes: 0x0000000000000001, 0x0000000000000000 Exception Note: EXC_CORPSE_NOTIFY Termination Signal: Illegal instruction: 4 Termination Reason: Namespace SIGNAL, Code 0x4 Terminating Process: exc handler [3774] ...
0
0
907
Oct ’21
Random crashes on Xcode 13
Installed beta 5 of Xcode 13. Getting a lot of random crashes in different places of application (e.g): Thread 8: EXC_BREAKPOINT (code=1, subcode=0x1c80eb414) Here is instruction list: libsystem_platform.dylib`_os_semaphore_dispose.cold.1:     0x1c80eb3f0 <+0>:  sxtw   x8, w0     0x1c80eb3f4 <+4>:  stp    x20, x21, [sp, #-0x10]!     0x1c80eb3f8 <+8>:  adrp   x20, 0     0x1c0eb3fc <+12>: add    x20, x20, #0xd52          ; =0xd52      0x1c80eb400 <+16>: adrp   x21, 75707     0x1c80eb404 <+20>: add    x21, x21, #0x568          ; =0x568      0x1c80eb408 <+24>: str    x20, [x21, #0x8]     0x1c80eb40c <+28>: str    x8, [x21, #0x38]     0x1c80eb410 <+32>: ldp    x20, x21, [sp], #0x10 ->  0x1c80eb414 <+36>: brk    #0x1 How can I find more info about this crash? Env is : Mac mini M1 and Simulator.
7
0
2.5k
Sep ’21
Static libraries into XCFramework
I have number of static libraries, all of them build as a fat library (arm64, x86_64 are architectures). I'm implementing dynamic framework that works with these libraries. They are added into the frameworks with As a requirement from a client comes to have also XCFramework. XCFramework is created successfully but only if EXCLUDED_ARCHS flag is set to YES in Simulator build script. If NO this is the error I'm getting: ... building for iOS Simulator, but linking in object file built for iOS, for architecture arm64. So is this a good approach or could be done better? I've learned today about --library flag on -create-xcframework but don't know whether they fit in my case. Also I was thinking to create XCFramework with static libraries and include it in my library. How about this option? Any advice will be helpful 👍 P.S My framework supports iOS 11, does this mean that I need to have version for armv7 in the static library?
5
2
8.3k
Apr ’21