Update: I worked it out, I needed to add my intent to 'Supported Intents' in my app target config.
I am now facing the following problem: The widget is showing placeholder coloured boxes when placed on the home screen. It shows fine in the preview before adding to Home Screen.
I think this is because the AppIntentTimelineProvider is looking for timeline(), whereas a static widget (TimelineProvider) and iOS are looking for getTimeline(). If I change timeline() to getTimeline(), it says it doesn’t conform. placeholder() is the same in both providers, which is why it shows fine before adding to home screen
I can provide screenshots, but it doesn't let me upload them
Post
Replies
Boosts
Views
Activity
Thanks, it works!
How do I then get the data from that into a variable? My multi-object one did it along the lines of:
swift
@State var moons: [SingleObject] = []
.onAppear {
ApiCall().getSingleObject{ (moons) in self.moons = moons}
}
The code I posted is my code for getting a multi-object JSON array, and I need to edit it to be for a single object.
Example single object response - https://developer.apple.com/forums/content/attachment/9f5498f2-dc95-4514-b036-46d16bb06c85
I tried using referenced links, but the forums wouldn’t allow them, so I just put them in plain text...
I haven’t attempted editing my old code the gets a multi-object array, as I don’t know where to start. My code is attached
My code - https://developer.apple.com/forums/content/attachment/7bb685f8-8fac-4a7d-a9bb-a2ed0f55be7d
I might try and work off of this one: https://github.com/RaffiKian/RKCalendar
Yes, I drew those dots on in Preview just to demonstrate my idea
I've started a new thread here - https://developer.apple.com/forums/thread/672131#672131021
OOPer's method worked! Apart from the fact that I display it all in a tabview, it now doesn't display correctly... Screenshots can be found in this iCloud folder - https://www.icloud.com/iclouddrive/0ykn1UAHPLZnwM77yl8RoClmw#Apple_Dev_Forum, with the names incorrect display for the wrong display of my app, and correct display for how it should look...
Edit: fixed it, it was me being silly. Thanks OOPer for the help!
Edit #2: Each time a modal shows up, it adds a new tab to my TabView, it never used to do this... How do I stop that?
I have moved quite a chunk of code to a new Swift file called rocketView, it got rid of the original error, but now I get the error Cannot convert value of type '(inout [Rocket]) -> ()' to expected argument type '([Rocket]) -> ()' on line 45... my code is attached. (Line 45 is the line between }.onAppear { and }.listStyle...
my code - https://developer.apple.com/forums/content/attachment/88bd6562-5c10-4e8b-a1dd-e479d3ef1df0
I moved the group from body > tab view > group > ZStack > NavigationView > VStack > List > ForEach > Button > HStack to its own View, but now I get more errors... The view looks like:
var bodyGroup: some View {
Group {
Text(launch.name)
.font(.system(size: 23))
.frame(maxWidth: .infinity, alignment: .leading)
.fixedSize(horizontal: false, vertical: true)
Text(Date(timeIntervalSince1970: launch.date_unix).getFormattedDate(format: "dd/MM/yyyy HH:mm:ss"))
.font(.system(size: 11.5))
.foregroundColor(Color.gray)
.frame(maxWidth: .infinity, alignment: .leading)
.fixedSize(horizontal: false, vertical: true)
Spacer()
}
}
The errors are The same original error
Cannot find 'launch' in scope (line 5)
Cannot find 'launch' in scope (line 13)
I never used to get these errors before I moved it to the view...
I can't because there is a character limit