private let datePicker = {
let picker = UIDatePicker()
picker.backgroundColor = .clear
picker.datePickerMode = .dateAndTime
picker.preferredDatePickerStyle = .compact
return picker
}()
Post
Replies
Boosts
Views
Activity
I have followed https://apple.github.io/coremltools/docs-guides/source/installing-coremltools.html but failed.
Looks like the doc is too outdated.
I'm using Core Data to save data. Then I wanna add spotlight support.
self.spotlightDelegate = StorageSpotlightDelegate(forStoreWith: description, coordinator: container.persistentStoreCoordinator)
let isSpotlightDisable = UserDefaults.standard.bool(forKey: "isSpotlightDisable")
if !isSpotlightDisable {
self.toggleSpotlightIndexing(enable: true)
}
public func toggleSpotlightIndexing(enable: Bool) {
guard let spotlightDelegate = spotlightDelegate else { return }
if enable {
spotlightDelegate.startSpotlightIndexing()
} else {
spotlightDelegate.stopSpotlightIndexing()
spotlightDelegate.deleteSpotlightIndex { error in
if let error = error {
print(error)
}
}
}
UserDefaults.standard.set(!enable, forKey: "isSpotlightDisable")
}
It works fine on an iOS15 device, but not work on iOS 17&18.
On iOS 18 devices, I can search the data when the first time to added to Core Data. But if I stop spotlight indexing and restart again, the data is never be searched.
How can I to solve this? And I noticed that the problem is also exists in another dictionary app.
Cannot select individual view in selectable mode in Xcode preview, it only show the whole blue device border.
I know that I can use face detect with CoreML, but I'm wandering that is there any to identify the same person between two images like Photos app.
I have added a button in UIController:
let button = UIButton(type: .custom)
button.setTitle("test", for: .normal)
button.addTarget(self, action: #selector(addToSiri), for: .touchUpInside)
self.view.addSubview(button)
Then using it in SwiftUI
HStack {
Controller()
}.frame(maxWidth:.infinity, idealHeight: 60)
And then using swiftUI in UIHostingController:
let vc = UIHostingController(rootView: SwiftUIView())
But when I tap the button, the addToSiri is never called.
I don't know why.
I have pushed an UIHostingController which contains SwiftUI and set the navigationBar hidden:
class CoverVC : UIHostingController<AnyView>{
public init(shouldShowNavigationBar: Bool, rootView: ICloudSyncView) {
super.init(rootView: AnyView(rootView.navigationBarHidden(!shouldShowNavigationBar)))
self.navigationController?.interactivePopGestureRecognizer?.delegate = self
}
@objc required dynamic init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
extension CoverVC: UIGestureRecognizerDelegate {
func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldBeRequiredToFailBy otherGestureRecognizer: UIGestureRecognizer) -> Bool {
return true
}
}
But the InteractivePopGestureRecognizer is disabled.
How can I to solve this?
I'm using core data in app, widget extension and intent, but I found the data is not updated between targets.
such as
I added a new record in app, the widget is not updated unless remove the widget and re-add it.
I added a new record in intent, the data in app is not updated unless I run the app again.
I have set container.viewContext.automaticallyMergesChangesFromParent = true but it doesn't work.
So how can I make the data is updated no matter it is modified any targets.
I have added a intent extension with SiriKit.
It works fine in iOS 17 simulator, but it always open the app directly on my iOS15 device.
I don't know what is the problem.
I'm using CoreData+CloudKit.
It works fine in development, so I deployed to production.
But I cannot see the data in CloudKit DataBase in a testflight version.
I don't know where I missed.
Can I just run in Release mode to check it works?
I have copied an sqlite file from document to app group container. I found that if I delete the app and reinstall, the file is automatically created.
How is that happed? The app group container is not just a folder and can be synchronized by iCloud?
I cannot find any informations about the feature. If there is, please show me the link, thanks
I wanna add an intents app extension on iOS 15, I'm following the link https://toolboxpro.app/blog/adding-shortcuts-to-an-app-1.
It works fine when running the extension target on device, but here comes the error "Could not run Make Uppercase,There was a problem with the app" when I running the main target.
There is no exception or breakpoint in Xcode so I don't know what's the problem. Any help will be appreciate, thanks.