Posts

Post not yet marked as solved
6 Replies
3.0k Views
I have noticed lag and low frame rate (30-36fps) in ARKit apps built with Xcode 11.4 on the new iPad Pro (12.9" 4th gen). Exisitng AR apps from the App Store and AR QuickLook work as expected. The same apps built with Xcode 11.4 run well on my iPhone XR. For an example, I ran the RealityKit template app with no modifications on each device, and the iPad has anywhere from 30-36 fps fps while the iPhone stays constant at 60 fps. Is anyone else experiencing this issue? Thanks!
Posted
by eos-pi.
Last updated
.
Post not yet marked as solved
13 Replies
16k Views
I added @EnvironmentObject to a property in a SwiftUI view as part of the official tutorial Adding User Interaction and added the .environmentObject modifier to the preview. However, I get the error:Cannot preview in this file - MyApp.app may have crashedThis error now appears in every SwiftUI project, even ones without EnvironmentObject or a blank SwiftUI template, so I cannot use previews. I have tried rebooting several times, and made sure the command line tools are set to Xcode 11. How can I fix this? Thanks!
Posted
by eos-pi.
Last updated
.
Post marked as solved
3 Replies
3k Views
I'm using WatchConnectivity and the WCSessionDelegate to successfully receive user info from my iOS app to my watchOS extension. When new data is received, I want to update my SwiftUI view with the latest information. I have an @ObservedObject property in the HostingController which is set to the latest data when it arrives. However, this does not trigger a UI update. How can I fix this? I've posted the code below. Thank you!import WatchKit import SwiftUI import WatchConnectivity import Combine class UserData: ObservableObject { @Published var account: Account = Account.getCurrentAccount() } class HostingController: WKHostingController<ContentView>, WCSessionDelegate { @ObservedObject private var userData: UserData = UserData() override init() { super.init() if WCSession.isSupported() { print("WCSession supported") let session = WCSession.default session.delegate = self session.activate() } } override var body: ContentView { return ContentView(userData: userData) } func session(_ session: WCSession, activationDidCompleteWith activationState: WCSessionActivationState, error: Error?) { } func session(_ session: WCSession, didReceiveUserInfo userInfo: [String : Any] = [:]) { guard let accountJSON = userInfo["main-account"] as? String else { return } let userDefaults = UserDefaults() userDefaults.set(accountJSON, forKey: "main-account") self.userData.account = Account.getCurrentAccount() print("\n\nReceived this: \(accountJSON) \n\n") } }
Posted
by eos-pi.
Last updated
.
Post not yet marked as solved
0 Replies
769 Views
I have a TabView with the PageTabViewStyle, and I am trying to implement continuous scrolling. After the last page, I'd like a right swipe to go back to the first page, and on the first page, a left swipe should go to the last page. I couldn't find a default option for this, so I attempted the following modifier. The gesture doesn't seem to work directly on top of the TabView, so is there a way to implement this? Thank you! TabView(selection: $currentIndex) { &#9;&#9;ForEach(0..<count) { item in &#9;&#9;&#9;&#9; Text("\(item)") &#9;&#9;} .tabViewStyle(PageTabViewStyle(indexDisplayMode: .never))             .gesture(                 DragGesture()                     .onEnded { value in                         if currentIndex == count-1 {                             currentIndex = 0                         }                     }             )
Posted
by eos-pi.
Last updated
.