Post

Replies

Boosts

Views

Activity

Reply to Generics and AssociatedTypes
This should work class PersistantStorage<T: Codable & Identifiable> { func store(_ object: T) throws { } func objectFor(_ key: T.ID) -> T? { return nil } } You could also write it like this: class PersistantStorage<T> where T: Codable & Identifiable{ func store(_ object: T) throws { } func objectFor(_ key: T.ID) -> T? { return nil } }
Topic: Programming Languages SubTopic: Swift Tags:
Jun ’22
Reply to Draw an apple using SwiftUI and path
Here is an example I've written a few month ago: import SwiftUI struct Apple: Shape { func path(in rect: CGRect) -> Path { Path { path in let width = rect.width let height = rect.height //Draw the apple's body path.move(to: CGPoint(x: width * 0.55, y: height * 0.31)) path.addCurve( to: CGPoint(x: width * 0.56, y: height * 0.96), control1: CGPoint(x: width * 0.85, y: height * 0.15), control2: CGPoint(x: width * 0.7, y: height * 1.1) ) path.addCurve( to: CGPoint(x: width * 0.55, y: height * 0.31), control1: CGPoint(x: width * 0.36, y: height * 1.15), control2: CGPoint(x: width * 0.24, y: height * 0.18) ) } } } struct AppleView: View { var body: some View { ZStack { Apple() .fill(.red) .frame(height: 210, alignment: .center) //Draw the leaf of the apple Ellipse() .fill(.green) .rotationEffect(.degrees(45)) .offset(x: 30, y: -56) .frame(width: 20, height: 50, alignment: .center) } } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Dec ’22
Reply to Thread 1: "NSFetchRequest could not locate an NSEntityDescription for entity name 'Goal'"
From Apple DTS: This is an issue on the framework side – when an app uses a ModelContainer with multiple ModelConfiguration to manage multiple stores, only the model types specified in the first configuration are loaded, and that triggers the error. This issue should have been fixed in iOS 17.4, which is now beta 2. You can download the beta and give it a try. Feel free to follow up if the issue is still there. If you would like to support versions before 17.4, consider creating one container per configuration.
Topic: Programming Languages SubTopic: Swift Tags:
Feb ’24
Reply to App Intents not discovered by iOS 16 Beta 1
Hello It's not working for me either.
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jun ’22
Reply to App Intents not discovered by iOS 16 Beta 1
I also tried implementing the  SiriTipView(intent: AddDataIntent()) in one of my views in SwiftUI, however I can't see it.
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jun ’22
Reply to Generics and AssociatedTypes
This should work class PersistantStorage<T: Codable & Identifiable> { func store(_ object: T) throws { } func objectFor(_ key: T.ID) -> T? { return nil } } You could also write it like this: class PersistantStorage<T> where T: Codable & Identifiable{ func store(_ object: T) throws { } func objectFor(_ key: T.ID) -> T? { return nil } }
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Jun ’22
Reply to Draw an apple using SwiftUI and path
Here is an example I've written a few month ago: import SwiftUI struct Apple: Shape { func path(in rect: CGRect) -> Path { Path { path in let width = rect.width let height = rect.height //Draw the apple's body path.move(to: CGPoint(x: width * 0.55, y: height * 0.31)) path.addCurve( to: CGPoint(x: width * 0.56, y: height * 0.96), control1: CGPoint(x: width * 0.85, y: height * 0.15), control2: CGPoint(x: width * 0.7, y: height * 1.1) ) path.addCurve( to: CGPoint(x: width * 0.55, y: height * 0.31), control1: CGPoint(x: width * 0.36, y: height * 1.15), control2: CGPoint(x: width * 0.24, y: height * 0.18) ) } } } struct AppleView: View { var body: some View { ZStack { Apple() .fill(.red) .frame(height: 210, alignment: .center) //Draw the leaf of the apple Ellipse() .fill(.green) .rotationEffect(.degrees(45)) .offset(x: 30, y: -56) .frame(width: 20, height: 50, alignment: .center) } } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Dec ’22
Reply to Thread 1: "NSFetchRequest could not locate an NSEntityDescription for entity name 'Goal'"
From Apple DTS: This is an issue on the framework side – when an app uses a ModelContainer with multiple ModelConfiguration to manage multiple stores, only the model types specified in the first configuration are loaded, and that triggers the error. This issue should have been fixed in iOS 17.4, which is now beta 2. You can download the beta and give it a try. Feel free to follow up if the issue is still there. If you would like to support versions before 17.4, consider creating one container per configuration.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Feb ’24