I was also able to reproduce this by creating a new barebones project, with adding only two files:
MyObjectiveC.m
#import "MyTestProject-Swift.h"
and
MySwift.swift
import DeviceActivity
import ManagedSettings
import Foundation
@objc(MyMonitor)
class MyMonitor: DeviceActivityMonitor {
}
Post
Replies
Boosts
Views
Activity
I was also able to reproduce this by creating a new barebones project, with adding only two files:
"MyObjectiveC.m "
#import "MyTestProject-Swift.h"
and "MySwift.swift"
import DeviceActivity import ManagedSettings import Foundation @objc(MyMonitor) class MyMonitor: DeviceActivityMonitor { }
If there was a way to use SwiftUI without needing to import MyProject-Swift.h into ObjC, then I would be able to avoid this issue I think... But I can't find a way to do this
Maybe I have to create my own header for DeviceActivity... But that seems wrong
For more info -
With the current code, the apps are correctly blocked upon selection in the picker. Then, the schedule is created and they stay blocked, until intervalDidEnd() is called, which lifts the restrictions. But, the next time intervalDidStart() comes around, the apps are not blocked again.
I've basically confirmed that :
let applications = model.selectionToDiscourage.applicationTokens let categories = model.selectionToDiscourage.categoryTokens let webCategories = model.selectionToDiscourage.webDomainTokens are all not set in MyMonitor, when they are set outside of the extension. Not sure how to fix this.. As MyModel targets the extension
I've confirmed that MyModel's values are not present in MyMonitor. I'm not sure why though
Same issue for me