I'm writing a SpriteKit game in Swift that does this familiar dance in my GameScene touchesEnded(...)...
let touch = touches.first!.location(in: self)
let nodes = self.nodes(at: touch)
...but sometimes when the game is running, the nodes collection is empty, even though there are clearly, visibly nodes under the touch. All of the nodes I care about are children of a single SKNode, MapNode, that is one of two children of the GameScene.
After a bunch of debugging, I've noticed that when this problem happens, something is causing calculateAccumulatedFrame() to return a frame that is way, way smaller than the real bounds of MapNode.
When the scene begins, calculateAccumulatedFrame() is perfect, but something that happens later on breaks it. I've tried adding a node to MapNode that is the correct size to 'force' calculateAccumulatedFrame to do the right thing, but this doesn't work.
Is there something obvious I am doing wrong, or some common pitfalls? Is there some way to force calculateAccumulatedFrame to return this correct size?
Post not yet marked as solved
I added debug break point to the first line of MyDeviceActivityMonitor.swift, it never got trigger.
I am able to launch the app, select discouraged and encouraged app.
discouraged apps are getting restricted which is expected. but device activity extension is never called.
I have all the permission and certificate. I created an app group.
import SwiftUI
import FamilyControls
import ManagedSettings
@main
struct GetALifeApp: App {
@UIApplicationDelegateAdaptor(AppDelegate.self) private var appDelegate
@StateObject var model = MyModel.shared
@StateObject var store = ManagedSettingsStore()
var body: some Scene {
WindowGroup {
ContentView()
.environmentObject(model)
.environmentObject(store)
}
}
}
class AppDelegate: NSObject, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
initiateAsyncSetup()
MySchedule.setSchedule()
return true
}
private func initiateAsyncSetup() {
Task {
do {
try await AuthorizationCenter.shared.requestAuthorization(for: .individual)
} catch {
print("Error during asynchronous setup: \(error)")
}
}
}
}
import Foundation
import FamilyControls
import ManagedSettings
private let _MyModel = MyModel()
class MyModel: ObservableObject {
let store = ManagedSettingsStore()
@Published var selectionToDiscourage: FamilyActivitySelection
@Published var selectionToEncourage: FamilyActivitySelection
init() {
selectionToDiscourage = FamilyActivitySelection()
selectionToEncourage = FamilyActivitySelection()
}
class var shared: MyModel {
return _MyModel
}
func setShieldRestrictions() {
let applications = MyModel.shared.selectionToDiscourage
store.shield.applications = applications.applicationTokens.isEmpty ? nil : applications.applicationTokens
store.shield.applicationCategories = applications.categoryTokens.isEmpty
? nil
: ShieldSettings.ActivityCategoryPolicy.specific(applications.categoryTokens)
}
}
import Foundation
import DeviceActivity
extension DeviceActivityName {
static let daily = Self("daily")
}
extension DeviceActivityEvent.Name {
static let encouraged = Self("encouraged")
}
let schedule = DeviceActivitySchedule(
intervalStart: DateComponents(hour: 0, minute: 0),
intervalEnd: DateComponents(hour: 23, minute: 59),
repeats: true
)
class MySchedule {
static public func setSchedule() {
print("Setting schedule...")
print("Hour is: ", Calendar.current.dateComponents([.hour, .minute], from: Date()).hour!)
let events: [DeviceActivityEvent.Name: DeviceActivityEvent] = [
.encouraged: DeviceActivityEvent(
applications: MyModel.shared.selectionToEncourage.applicationTokens,
threshold: DateComponents(second: 2)
)
]
let center = DeviceActivityCenter()
do {
print("Try to start monitoring...")
print(events)
try center.startMonitoring(.daily, during: schedule, events: events)
} catch {
print("Error monitoring schedule: ", error)
}
}
}
import SwiftUI
struct ContentView: View {
@State private var isDiscouragedPresented = false
@State private var isEncouragedPresented = false
@EnvironmentObject var model: MyModel
var body: some View {
VStack {
Button("Select Apps to Discourage") {
isDiscouragedPresented = true
}
.familyActivityPicker(isPresented: $isDiscouragedPresented, selection: $model.selectionToDiscourage)
Button("Select Apps to Encourage") {
isEncouragedPresented = true
}
.familyActivityPicker(isPresented: $isEncouragedPresented, selection: $model.selectionToEncourage)
}
.onChange(of: model.selectionToDiscourage) {
MyModel.shared.setShieldRestrictions()
}
.onChange(of: model.selectionToEncourage) {
MySchedule.setSchedule()
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
.environmentObject(MyModel())
}
}
import Foundation
import DeviceActivity
import ManagedSettings
class MyDeviceActivityMonitor: DeviceActivityMonitor {
let store = ManagedSettingsStore()
override func intervalDidStart(for activity: DeviceActivityName) {
print("intervalDidStart")
super.intervalDidStart(for: activity)
store.shield.applications = nil
print("intervalDidStart")
}
override func intervalDidEnd(for activity: DeviceActivityName) {
super.intervalDidEnd(for: activity)
}
override func eventDidReachThreshold(_ event: DeviceActivityEvent.Name, activity: DeviceActivityName) {
super.eventDidReachThreshold(event, activity: activity)
print("used encouraged")
store.shield.applications = nil
}
override func intervalWillStartWarning(for activity: DeviceActivityName) {
super.intervalWillStartWarning(for: activity)
// Handle the warning before the interval starts.
}
override func intervalWillEndWarning(for activity: DeviceActivityName) {
super.intervalWillEndWarning(for: activity)
// Handle the warning before the interval ends.
}
override func eventWillReachThresholdWarning(_ event: DeviceActivityEvent.Name, activity: DeviceActivityName) {
super.eventWillReachThresholdWarning(event, activity: activity)
// Handle the warning before the event reaches its threshold.
}
}
Post not yet marked as solved
I already filed feedback FB13777941 for this, but wanted to ask if anyone has the same problem, since I can't find anything on google or SO.
I created a new package in Xcode (15.3) and added this to it:
import SwiftUI
struct Test: View {
var body: some View {
Text("Hello world")
}
}
#Preview {
Test()
}
The package builds, tests can run. Previews don't work.
This is more or less the error I get from the diagnostics button (formatted for readability):
LoadingError: failed to load library at path ”PATH_TO_DERIVED_DATA/Build/Intermediates.noindex/Previews/macos/PACKAGE_NAME/Products/Debug/PackageFrameworks/PACKAGE_NAME_63097C4A372B9C87_PackageProduct.framework/PACKAGE_NAME_63097C4A372B9C87_PackageProduct”: Optional(dlopen(PATH_TO_DERIVED_DATA/Build/Intermediates.noindex/Previews/macos/PACKAGE_NAME/Products/Debug/PackageFrameworks/PACKAGE_NAME_63097C4A372B9C87_PackageProduct.framework/PACKAGE_NAME_63097C4A372B9C87_PackageProduct, 0x0000):
tried:
'PATH_TO_DERIVED_DATA/Build/Intermediates.noindex/Previews/macos/PACKAGE_NAME/Products/Debug/PACKAGE_NAME_63097C4A372B9C87_PackageProduct.framework/PACKAGE_NAME_63097C4A372B9C87_PackageProduct' (no such file),
'PATH_TO_DERIVED_DATA/Build/Intermediates.noindex/Previews/macos/PACKAGE_NAME/Products/Debug/PackageFrameworks/PACKAGE_NAME_63097C4A372B9C87_PackageProduct.framework/PACKAGE_NAME_63097C4A372B9C87_PackageProduct' (mach-o file, but is an incompatible architecture (have 'arm64', need 'arm64e')),
'/System/Volumes/Preboot/Cryptexes/OSPATH_TO_DERIVED_DATA/Build/Intermediates.noindex/Previews/macos/PACKAGE_NAME/Products/Debug/PackageFrameworks/PACKAGE_NAME_63097C4A372B9C87_PackageProduct.framework/PACKAGE_NAME_63097C4A372B9C87_PackageProduct' (no such file),
'PATH_TO_DERIVED_DATA/Build/Intermediates.noindex/Previews/macos/PACKAGE_NAME/Products/Debug/PackageFrameworks/PACKAGE_NAME_63097C4A372B9C87_PackageProduct.framework/PACKAGE_NAME_63097C4A372B9C87_PackageProduct' (mach-o file, but is an incompatible architecture (have 'arm64', need 'arm64e')),
'PATH_TO_DERIVED_DATA/Build/Intermediates.noindex/Previews/macos/PACKAGE_NAME/Products/Debug/PACKAGE_NAME_63097C4A372B9C87_PackageProduct.framework/Versions/A/PACKAGE_NAME_63097C4A372B9C87_PackageProduct' (no such file),
'PATH_TO_DERIVED_DATA/Build/Intermediates.noindex/Previews/macos/PACKAGE_NAME/Products/Debug/PackageFrameworks/PACKAGE_NAME_63097C4A372B9C87_PackageProduct.framework/Versions/A/PACKAGE_NAME_63097C4A372B9C87_PackageProduct' (mach-o file, but is an incompatible architecture (have 'arm64', need 'arm64e')),
'/System/Volumes/Preboot/Cryptexes/OSPATH_TO_DERIVED_DATA/Build/Intermediates.noindex/Previews/macos/PACKAGE_NAME/Products/Debug/PackageFrameworks/PACKAGE_NAME_63097C4A372B9C87_PackageProduct.framework/Versions/A/PACKAGE_NAME_63097C4A372B9C87_PackageProduct' (no such file),
'PATH_TO_DERIVED_DATA/Build/Intermediates.noindex/Previews/macos/PACKAGE_NAME/Products/Debug/PackageFrameworks/PACKAGE_NAME_63097C4A372B9C87_PackageProduct.framework/Versions/A/PACKAGE_NAME_63097C4A372B9C87_PackageProduct' (mach-o file, but is an incompatible architecture (have 'arm64', need 'arm64e')))
I don't remember ever having this problem. The arm64 vs arm64e makes no sense to me - why would Xcode get that wrong... and only for previews?
I've tried restarting, deleting derived data, the usual rain dances.
Any ideas?
Post not yet marked as solved
I am new to swift. This is my first app. What an i doing wrong.
Device activity monitor extension is never being called.
When i launch the app, I am able to pick the discouraged and encouraged apps.
It immediately restrict the discouraged app which is expected. But the extension is never called.
import SwiftUI
import FamilyControls
import ManagedSettings
@main
struct GetALifeApp: App {
@UIApplicationDelegateAdaptor(AppDelegate.self) private var appDelegate
@StateObject var model = MyModel.shared
@StateObject var store = ManagedSettingsStore()
var body: some Scene {
WindowGroup {
ContentView()
.environmentObject(model)
.environmentObject(store)
}
}
}
class AppDelegate: NSObject, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
initiateAsyncSetup()
return true
}
private func initiateAsyncSetup() {
Task {
do {
try await AuthorizationCenter.shared.requestAuthorization(for: .individual)
MySchedule.setSchedule()
} catch {
print("Error during asynchronous setup: \(error)")
}
}
}
}
import Foundation
import FamilyControls
import ManagedSettings
private let _MyModel = MyModel()
class MyModel: ObservableObject {
let store = ManagedSettingsStore()
@Published var selectionToDiscourage: FamilyActivitySelection
@Published var selectionToEncourage: FamilyActivitySelection
init() {
selectionToDiscourage = FamilyActivitySelection()
selectionToEncourage = FamilyActivitySelection()
}
class var shared: MyModel {
return _MyModel
}
func setShieldRestrictions() {
let applications = MyModel.shared.selectionToDiscourage
store.shield.applications = applications.applicationTokens.isEmpty ? nil : applications.applicationTokens
store.shield.applicationCategories = applications.categoryTokens.isEmpty
? nil
: ShieldSettings.ActivityCategoryPolicy.specific(applications.categoryTokens)
}
}
import Foundation
import DeviceActivity
extension DeviceActivityName {
static let daily = Self("daily")
}
extension DeviceActivityEvent.Name {
static let encouraged = Self("encouraged")
}
let schedule = DeviceActivitySchedule(
intervalStart: DateComponents(hour: 0, minute: 0),
intervalEnd: DateComponents(hour: 23, minute: 59),
repeats: true
)
class MySchedule {
static public func setSchedule() {
print("Setting schedule...")
print("Hour is: ", Calendar.current.dateComponents([.hour, .minute], from: Date()).hour!)
let events: [DeviceActivityEvent.Name: DeviceActivityEvent] = [
.encouraged: DeviceActivityEvent(
applications: MyModel.shared.selectionToEncourage.applicationTokens,
threshold: DateComponents(second: 2)
)
]
let center = DeviceActivityCenter()
do {
print("Try to start monitoring...")
try center.startMonitoring(.daily, during: schedule, events: events)
} catch {
print("Error monitoring schedule: ", error)
}
}
}
import SwiftUI
struct ContentView: View {
@State private var isDiscouragedPresented = false
@State private var isEncouragedPresented = false
@EnvironmentObject var model: MyModel
var body: some View {
VStack {
Button("Select Apps to Discourage") {
isDiscouragedPresented = true
}
.familyActivityPicker(isPresented: $isDiscouragedPresented, selection: $model.selectionToDiscourage)
Button("Select Apps to Encourage") {
isEncouragedPresented = true
}
.familyActivityPicker(isPresented: $isEncouragedPresented, selection: $model.selectionToEncourage)
}
.onChange(of: model.selectionToDiscourage) { newSelection in
MyModel.shared.setShieldRestrictions()
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
.environmentObject(MyModel())
}
}
import Foundation
import DeviceActivity
import ManagedSettings
class MyDeviceActivityMonitor: DeviceActivityMonitor {
let store = ManagedSettingsStore()
override func intervalDidStart(for activity: DeviceActivityName) {
print("intervalDidStart")
super.intervalDidStart(for: activity)
store.shield.applications = nil
print("intervalDidStart")
}
override func intervalDidEnd(for activity: DeviceActivityName) {
super.intervalDidEnd(for: activity)
}
override func eventDidReachThreshold(_ event: DeviceActivityEvent.Name, activity: DeviceActivityName) {
super.eventDidReachThreshold(event, activity: activity)
print("used encouraged")
store.shield.applications = nil
}
override func intervalWillStartWarning(for activity: DeviceActivityName) {
super.intervalWillStartWarning(for: activity)
// Handle the warning before the interval starts.
}
override func intervalWillEndWarning(for activity: DeviceActivityName) {
super.intervalWillEndWarning(for: activity)
// Handle the warning before the interval ends.
}
override func eventWillReachThresholdWarning(_ event: DeviceActivityEvent.Name, activity: DeviceActivityName) {
super.eventWillReachThresholdWarning(event, activity: activity)
// Handle the warning before the event reaches its threshold.
}
}
Post not yet marked as solved
Dear all,
I have the following two classes:
Stagioni:
import SwiftData
@Model
class Stagione {
@Attribute(.unique) var idStagione: String
var categoriaStagione: String
var miaSquadra: String
@Relationship(deleteRule: .cascade) var rosa: [Rosa]?
@Relationship(deleteRule: .cascade) var squadra: [Squadre]?
@Relationship(deleteRule: .cascade) var partita: [CalendarioPartite]?
init(idStagione: String, categoriaStagione: String, miaSquadra: String) {
self.idStagione = idStagione
self.categoriaStagione = categoriaStagione
self.miaSquadra = miaSquadra
}
}
CalendarioPartite:
import SwiftData
@Model
class CalendarioPartite {
var idGiornata: Int
var dataPartita: Date
var squadraCasa: String
var squadraTrasferta: String
var golCasa: Int
var golTrasferta: Int
var stagione: Stagione?
init(idGiornata: Int, dataPartita: Date, squadraCasa: String, squadraTrasferta: String, golCasa: Int, golTrasferta: Int) {
self.idGiornata = idGiornata
self.dataPartita = dataPartita
self.squadraCasa = squadraCasa
self.squadraTrasferta = squadraTrasferta
self.golCasa = golCasa
self.golTrasferta = golTrasferta
}
}
Now, I'd like to have a query which is showing in a view the list of partite depending on a selection of a specific Stagione.
I've tried with the following query, but I'm getting the following error: "Instance member 'selectedStagione' cannot be used on type 'CalendarioCampionatoView'; did you mean to use a value of this type instead?"
@Query(filter: #Predicate<CalendarioPartite> { $0.stagione == selectedStagione}) private var partite: [CalendarioPartite] = []
What I'm doing wrong?
Thanks,
A.
Post not yet marked as solved
I am guessing this is a NavigationSplitView and the menu is in the sidebar closure. But I'm not quite sure how to reproduce this style of menu. Along with the collapsing breadcrumb for back button. I would have thought this would be out of the box?
Post not yet marked as solved
There seems to be a long running issue with WidgetKit where some users don't see the widget when trying to add to their Home Screen. (even after opening the app for the first time).
I have been able to reproduce myself intermittently, and typically restarting the phone or re-installing the app fixes the problem. However, some of my users have encountered this and end up requesting refunds because they think the app is broken.
Has anybody else experienced this issue?
Would be great to get this bug resolved as it's frustrating for users.
Post not yet marked as solved
He terminado de desarrollar una nueva versión de mi aplicación, la cual incluye notificaciones a través de FireBase Cloud Messaging. A la hora de compilar la aplicación para probar las funcionalidades. Me sale el siguiente error:
El ContentView de mi aplicación es el siguiente.
import SwiftUI
import WebKit
import Firebase
import FirebaseMessaging
class AppDelegate: NSObject, UIApplicationDelegate, UNUserNotificationCenterDelegate {
func application (_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions:
[UIApplication.LaunchOptionsKey: Any]?) -> Bool {
FirebaseApp.configure ()
requestAuthorizationForPushNotification(application: application)
return true
}
func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, witchCompletionHandler
completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
completionHandler([.banner, .sound])
}
func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler
completionHandler: @escaping () -> Void) {
completionHandler()
}
private func requestAuthorizationForPushNotification(application: UIApplication) {
UNUserNotificationCenter.current().delegate = self
UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .badge, .sound]) { _, _ in }
application.registerForRemoteNotifications()
}
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
Messaging.messaging().apnsToken = deviceToken
}
struct ContentView: View {
@State private var showWebView = false
private let urlString: String = "https://b-p-s-o-badajoz-beta.flutterflow.app/"
var body: some View {
VStack(spacing: 40) {
WebView(url: URL(string: urlString)!).frame(height: 890.0) .cornerRadius(10)
.shadow(color: .black.opacity(0.3), radius: 20.0, x: 5, y: 5)
}
}
struct WebView: UIViewRepresentable {
var url: URL
func makeUIView(context: Context) -> WKWebView {
return WKWebView()
}
func updateUIView(_ uiView: WKWebView, context: Context) {
let request = URLRequest(url: url)
uiView.load(request)
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
}
}
Post not yet marked as solved
In visionOS. mix mode, I place a virtual object on the floor and a chair in front of it, but the chair does not obstruct the virtual object, making the effect unrealistic. How to make chairs and other objects in reality cover virtual objects
Post not yet marked as solved
Hi, I spent almost half a year developing the app. Now it got stuck on review. The last message I got was on March 6 telling me that:
We need additional time to evaluate your submission and Apple Developer Program account. Your submission status will appear as "Rejected" in App Store Connect while we investigate. However, we do not require a revised binary or additional information from you at this time.
I have no idea what do and would appreciate any help
Post not yet marked as solved
Xcode version: 15.2, iOS deployment target 15.0
When experimenting with the new Xcode 15/new linker feature "Mergable Libraries" I came across an issue with subproject framework products.
I have a workspace with two projects.
I want to create a group framework named GroupFramework that consists of three other frameworks. FrameworkA, FrameworkB and FrameworkC.
FrameworkA and FrameworkB are in the same project as the group framework I want to create. FrameworkC is a product of another project in my workspace.
GroupFramework has all three frameworks linked in the "link binary with libraries" build phase.
GroupFramework has "Create merged binary" set to manual because I want to control which frameworks are linked. FrameworkA, FrameworkB and FrameworkC all have "Build mergeabe library" set to YES.
The application builds in both RELEASE and DEBUG.
Running in DEBUG and RELEASE
When running the application on a device in DEBUG or RELEASE it crashes with a linker error because FrameworkC can't be found on disk.
When inspecting the app binary in RELEASE I can see that FrameworkA and FrameworkB are both in the ReexportedBinary folder, but FrameworkC is nowhere to be seen.
I have tried embedding FrameworkC explicitly in the settings of the GroupFramework essentially creating an umbrella framework, and that also does not fix the issue.
I have also tried embedding FrameworkC directly into the AppTarget that will consume GroupFramework. This solves the linking issue but a new issue regarding unresolved symbols then crops up.
It appears as though the Reexporting and Merging of subproject frameworks is not working compared to a product that exists in the same project or at least may require a lot more manual configuration which is not currently documented anywhere. If this is the case, it could be very problematic when trying to adopt mergeable libraries in multi-project workspaces.
Post not yet marked as solved
I have spent hours trying to get @Query macros to compile. Mostly they throw up meaningless errors for example the following produces 3 compiler errors:
@Query var stylesheets: [StyleSheet]
Here's the expansion.
The compiler complains that 'private' can't be used here, and it can't find _stylesheets. I searched everywhere to find a resolution then I came across the Query struct. I used it as follows to replace the @Query:
let query = Query(FetchDescriptor<StyleSheet>(), animation: .smooth)
let styleSheets = query.wrappedValue
This also solves another issue that was bugging me - how to get the context when the environment variable is often rejected. All I need to do now is write:
let context = query.modelContext
None of the WWDC23 SwiftData videos mentions the use of the struct, which is a shame. It feels much like the CoreData approach to fetching data.
I hope this helps some of you.
Post not yet marked as solved
Can someone update about the current state of the Automator app in macOS. Automator seems like a valuable tool for automating tasks on macOS but in the recent years I have noticed a growing emphasis on the Shortcuts app for automation.
It would be great if you could clarify the following:
• Current Status of Automator: Is there any official statement regarding the continued support of the Automator app in future macOS versions?
• Future of Automator: Does Apple plan to introduce new features or updates for Automator in upcoming releases?
• Indifference to Shortcuts App: From what I understand both the ‘Automator’ and the ‘Shortcuts’ app are used for creating workflows/shortcuts to automate tasks. What is it that Automator app has to offer which cannot be done using the Shortcuts app? assuming the continued support for the Automator app. Can all the automator workflows not be automated using the shortcuts app?
I understand that Apple is constantly innovating and introducing new tools. However, clarity regarding the future of Automator would be helpful for users like myself.
In addition, as a developer I wanted to offer some actions for my application in the Automator app, so that the user can make use of it to create some workflows. But from what I found in the apple documentation here, these action are created using the ‘Automator action’ Project type template in the xcode. However, in the current version of xcode 15, this project type seems to be missing. Does it indicate that apple no longer provides support for applications to create new automator action? If not, how can I provide automator actions for my xcode application?
Post not yet marked as solved
When following this guide https://developer.apple.com/documentation/xcode/embedding-a-helper-tool-in-a-sandboxed-app I cannot run the embedded binary.
I'm getting this error: "zsh: trace trap"
I would like to be able to use the embedded binary for NativeMessaging with for example Chrome but I can't figure out how to allow it to be executable even with sandboxing enabled.
How are Strongbox able to do this with their afproxy executable?
Post not yet marked as solved
Trying to implement sign in with apple for a web app project that does not have an associated mobile app.
Do I really need an app ID in this situation as there's no option to proceed without selecting one?
Post not yet marked as solved
Hi People :)
I'm experimenting with Swift/C++ interoperability these days.
I'd like to understand how could I conform a Swift class to Cxx header:
Like this:
import Application
class App: Application {
public func run() {
let app = NSApplication.shared
let delegate = AppDelegate()
app.delegate = delegate
app.run()
}
}
But I got this error:
/Users/tonygo/oss/native-research/App.swift:27:7: error: inheritance from non-protocol, non-class type 'Application'
class App: Application {
^
ninja: build stopped: subcommand failed.
That seems normal indeed.
Reproductible example: https://github.com/tony-go/native-research/tree/conform-swift-to-cxx-header (Just run make)
I also have another branch on that repo where I use an intermediate Cxx bridge file that conforms to the :Application class and use the Swift API, like this: https://github.com/tony-go/native-research/tree/main/app
Bit I think that its a lot of boilerplate.
So I wonder which approach could I take for this?
Cheers :)
Post not yet marked as solved
Where can I read the help for all Do Shell Script commands?
For example, there is a "test" command. Which reference book mentions this command? I.e. I want to go to some website, all the Do Shell Script commands will be there, and among these commands I will find the "test" command.
Or are there no such directories and the programmer should randomly find commands on the Internet on random sites?
Post not yet marked as solved
I want to change the display language, particularly for week and the year and date on MultiDatePicker.
By adjusting the locale, the year and date can be changed.
However, I'm unable to change the display for week .
I've tried several methods, such as setting the calendar and adjusting the time zone, but none of them seem to work.
Are there any good way to solve it?
Post not yet marked as solved
I was executing some code from Incorporating real-world surroundings in an immersive experience
func processReconstructionUpdates() async {
for await update in sceneReconstruction.anchorUpdates {
let meshAnchor = update.anchor
guard let shape = try? await ShapeResource.generateStaticMesh(from: meshAnchor) else { continue }
switch update.event {
case .added:
let entity = ModelEntity()
entity.transform = Transform(matrix: meshAnchor.originFromAnchorTransform)
entity.collision = CollisionComponent(shapes: [shape], isStatic: true)
entity.components.set(InputTargetComponent())
entity.physicsBody = PhysicsBodyComponent(mode: .static)
meshEntities[meshAnchor.id] = entity
contentEntity.addChild(entity)
case .updated:
guard let entity = meshEntities[meshAnchor.id] else { continue }
entity.transform = Transform(matrix: meshAnchor.originFromAnchorTransform)
entity.collision?.shapes = [shape]
case .removed:
meshEntities[meshAnchor.id]?.removeFromParent()
meshEntities.removeValue(forKey: meshAnchor.id)
}
}
}
I would like to toggle the Occlusion mesh available on the dev tools below, but programmatically. I would like to have a button, that would activate and deactivate that.
I was checking .showSceneUnderstanding but it does not seem to work in visionOS. I get the following error 'ARView' is unavailable in visionOS when I try what is available Visualizing and Interacting with a Reconstructed Scene
Post not yet marked as solved
I am trying to load an auxiliary window from an AppKit bundle that loads a NSViewController from a storyboard. This NSViewController displays a MKMapView.
I want to avoid supporting multiple windows from my Catalyst app so I do not want to load this window via a SceneDelegate, and that is why I have chosen to go the AppKit bundle route.
If I load a similar view controller which contains a single label, then all works as expected.
However, if I try to load a view controller with the MKMapView, I get the following error after crashing:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[MKMapView nsli_piercingToken]: unrecognized selector sent to instance 0x15410f600'
DropBox link to sample app with buttons on a view to select either the "Map View" (crashing) or the "Label View" (working):
https://www.dropbox.com/scl/fi/q9daurhzqvil9o2ry6k1t/CatalystMap.zip?rlkey=yjbqfn6uxfrfh1jgsdavagta7&dl=0