today-extension

iOS - Notify today extension for Core Data changes in the main app

限于喜欢 提交于 2020-06-25 16:56:58
问题 I have a NSManagedObject called Event that is shared between the host app and today extension. (In Target Membership, both the main app and the widget are checked). The host app and widget have the same App Group identifier and both share Data Model (In Target Membership, both the main app and the widget are checked). When I launch(run) the widget in Xcode, it shows all of the app events ( Event ) that are already saved in the host app. However, when I add a new event, it appears in the host

Can we use SwiftUi to build iOS Today Extension?

萝らか妹 提交于 2020-05-26 04:40:17
问题 I want to use Swift UI to build iOS's Today Extensions, but I don't know how to get started. 回答1: Check this UIHostingController tutorial out, easy, straightforward and works like a charm: https://medium.com/@code_cookies/swiftui-embed-swiftui-view-into-the-storyboard-a6fc96e7a0a1 回答2: Using an instance of UIHostingController as your NSExtensionPrincipalClass to instantiate your SwiftUI view should work on iOS 13. 来源: https://stackoverflow.com/questions/58490571/can-we-use-swiftui-to-build

Can we use SwiftUi to build iOS Today Extension?

廉价感情. 提交于 2020-05-26 04:40:08
问题 I want to use Swift UI to build iOS's Today Extensions, but I don't know how to get started. 回答1: Check this UIHostingController tutorial out, easy, straightforward and works like a charm: https://medium.com/@code_cookies/swiftui-embed-swiftui-view-into-the-storyboard-a6fc96e7a0a1 回答2: Using an instance of UIHostingController as your NSExtensionPrincipalClass to instantiate your SwiftUI view should work on iOS 13. 来源: https://stackoverflow.com/questions/58490571/can-we-use-swiftui-to-build

iOS today extension with core data

佐手、 提交于 2020-05-23 10:07:05
问题 I am trying to make a today extension for my ios app. That today extension will display the 'next' Course based on data saved with core data. I've been doing some research and I understand I have to share my persistentContainer with an appGroup. So I did : enabled appGroups for both ios app and today extension targets. coded a function to share it : public extension NSPersistentContainer { func addToAppGroup(id: String) { guard let fileContainer = FileManager.default.containerURL

How to open Specific View controller on Widgets/ Today Extension click

为君一笑 提交于 2020-04-08 07:57:09
问题 I am trying to open specific view controller on widgets click , but can not able to open it , i am able to open app using url schema but i want to open specific view controller how can i do this, here is code for open app using url schema : @IBAction func open_app(_ sender: Any) { extensionContext?.open(URL(string: "open://")! , completionHandler: nil) } on button click i am opeing app sucessfully using url schema. but now i want to open specific view controller on that click how can i do

How to open Specific View controller on Widgets/ Today Extension click

柔情痞子 提交于 2020-04-08 07:53:13
问题 I am trying to open specific view controller on widgets click , but can not able to open it , i am able to open app using url schema but i want to open specific view controller how can i do this, here is code for open app using url schema : @IBAction func open_app(_ sender: Any) { extensionContext?.open(URL(string: "open://")! , completionHandler: nil) } on button click i am opeing app sucessfully using url schema. but now i want to open specific view controller on that click how can i do

Today Extension with UICollectionView different behaviour compared to Single View Application

半世苍凉 提交于 2020-01-13 01:40:22
问题 I try to add a collection view to a Today Extension with specifying the items per row of 3 items and also with setting the section insets for with 20 for top, left, bottom and right. When I do this in a Single View Application everything is like expected, but when I do the same programmatically for the Today Extension the collection view looks different, especially the space of the right and bottom seems not to be like in the Single View Application. What's the reason why there is this

Custom figure doesn't display in Today Extension

南楼画角 提交于 2020-01-07 03:54:36
问题 I make progress circle in today extension. I create additional class for it. I can see it in storyboard with help of IBDesignable . But circle doesn't appear in today extension on real device ( iPhone 5s, iPad 3) or simulator. How can I fix it? import UIKit @IBDesignable class CPUView: UIView { // MARK: - colors @IBInspectable var firstColor: UIColor = UIColor.blackColor() @IBInspectable var secondColor: UIColor = UIColor.greenColor() @IBInspectable var thirdColor: UIColor = UIColor

Load file in Today extension when device is locked

佐手、 提交于 2020-01-04 06:07:20
问题 In my today extension with my device unlocked, this line of code works as expected, returning the data from the image path: let imageData = NSData(contentsOfFile: path) However when my device is locked with a passcode, it returns nil. Is there any way to access images in the file system when the device is locked? I can access UserDefaults just fine, but not files in the directory for my shared group. Here is how I am creating the path, calling imagePath , which is correctly populated with the

How to open “Add Widgets” View From App

▼魔方 西西 提交于 2020-01-03 19:16:54
问题 My App is supported Today Extension, I want to add a button to my app's settings view, so when the user clicks on it I switch the user to "Add Widget" view, i.e this view: so the user can add the desired widget. Is there a way to do that? or it's not possible? Thanks. 回答1: This is not possible. The only thing you can do is to tell your users about the widget and possibly how they can add a widget to the today view: Goto home screen swipe all to the left scroll to the bottom tap "Edit" tap "+"