Post

Replies

Boosts

Views

Activity

Reply to SceneKit Snapshot After Rotation
After reading through conversions between Euler angles and unit quaternions, I was able to write a function that converted my desired Euler xyz angles to a quaternion. This way, the snapshot function captures the rotation. Below is my method written in Swift to perform the conversion. func angleConversion(x: Float, y: Float, z: Float, w: Float) -> (Float, Float, Float, Float) {     let c1 = cos( x / 2 )     let c2 = cos( y / 2 )     let c3 = cos( z / 2 )     let s1 = sin( x / 2 )     let s2 = sin( y / 2 )     let s3 = sin( z / 2 )     let xF = s1 * c2 * c3 + c1 * s2 * s3     let yF = c1 * s2 * c3 - s1 * c2 * s3     let zF = c1 * c2 * s3 + s1 * s2 * c3     let wF = c1 * c2 * c3 - s1 * s2 * s3     return (xF, yF, zF, wF) } Implementation let (x, y, z, w) = angleConversion(x: 0, y: 1.1*Float(Double.pi), z: 0, w: 0) sphereNode.localRotate(by: SCNQuaternion(x, y, z, w))
Jun ’20
Reply to Widgets
If you are referring to the code along exercise from WWDC, you simply open the Xcode application and look for the Emoji Ranger Widget folder with the EmojiRangerWidget.swift widget file along with some intent files. There, you will find all of the code related to the widget and you can run the specific widget target like any other target for apps.
Jun ’20
Reply to Cannot import 3rd party framework to Widgetkit
Hello, From my conversations during the WidgetKit labs, I have come to the understanding that the widgets require pure SwiftUI. For that reason, frameworks such as SceneKit are unavailable to widgets because they are not pure SwiftUI. From the information you have provided, I'm not sure if the framework you are trying to use fits those criteria, but I would recommend creating a feedback report to suggest the ability to implement those kinds of frameworks.
Jun ’20
Reply to How often do I schedule Widget updates?
Hello, After discussing with an Apple Engineer today, he explained that while it is highly recommended to load as few entries and timelines as possible, loading on a minute basis is possible. With that in mind, he suggested that loading more entries in one timeline may be more efficient than loading small timelines. Personally, I am working on a timer-based app and have been able to successfully load the widget's data every minute with ease. In regards to the fitness app, there are probably a few things going on. The widget probably loads the user's data every hour or so. However, there is an API capability available so that if something were to occur within the actual health app, the app could signal the timeline to reload. This is purely a guess of how Apple would configure the widget, but those methods are available. Let me know if that information helped and if you have any questions I'd be happy to help discuss it further :)
Jun ’20
Reply to WIDGET KIT
Hello, I have been following along Apple's WidgetKit Code Along series from WWDC on the Apple Developer Site which I would highly recommend. In addition to the videos, they provide you with the code used in each video as well as links to documentation which explain some of the fundamentals like the timeline in more depth. Below I will attach a few of the links I've used to learn how to create a widget. Furthermore, if you are wondering how to simply create the widget, I would recommend following this - https://developer.apple.com/documentation/widgetkit/creating-a-widget-extension Apple documentation. Below are other useful resources WidgetKit Overview - https://developer.apple.com/documentation/widgetkit Creating/Setting up the widget - https://developer.apple.com/documentation/widgetkit/creating-a-widget-extension Sample Widget Code - https://developer.apple.com/documentation/widgetkit/building_widgets_using_widgetkit_and_swiftui Keeping a Widget Up To Date (Highly Recommend) - https://developer.apple.com/documentation/widgetkit/keeping-a-widget-up-to-date Code Along Pat 1 (2 and 3 accessible from link) - https://developer.apple.com/videos/play/wwdc2020/10034/ Good luck with the widget, I've had a lot of fun exploring them this week :)
Jun ’20
Reply to When a device is locked, is it possible to hide content in a widget?
I have been testing my widget the past few days on an iPhone XR and the widget uses its placeholder view while the device is locked and there is a lock icon next to the app name, along with all other widgets. However, once my face is recognized by the device, the widget unlocks without needing to swipe up and enter the home screen. So, the widget from my experience self locks and requires facial or password permission.
Jun ’20
Reply to Data Capacity of WidgetKit Timelines and Best Practices
After speaking with an engineer from Apple during the WidgetKit lab, he explained that my current implementation is valid and that it may in fact be more efficient to load one large timeline rather than relying on updating the timeline throughout the day. However, he did note that Apple has not tested the implementation of large quantities of entries in a timeline and that I should experiment with the capacity of the timeline.
Jun ’20
Reply to SceneKit with WidgetKit Implementation
After speaking with an engineer at Apple, he explained that the error is a result of the WidgetKit needing to be written in pure SwiftUI and that SceneKit is not supported. The solution he recommended is to create a separate function that creates a snapshot of the scene and to implement it as an image in the widget.
Jun ’20