Post

Replies

Boosts

Views

Activity

How do you style the custom markdown elements
In the "What's new in Foundation" and "What's new in SwiftUI" talks there were examples of creating custom Attributed String styles. The example shown was for a rainbow style. They showed creating the style, serializing the style, using the style in a String - but did not show how to actually render the text in the rainbow style. How is that part done in SwiftUI. ie if I have Text("My fake example of ^[a custom style](customStyle: redAndEmphasized).") How would i create the piece that renders "a custom style" with foregroundColor red and a heavy font? Thanks, Daniel
2
0
2.7k
Sep ’23
Context outside of SwiftUI Views
In a SwiftUI view it is easy to pull mainContext out of the Environment (thanks for that). I have two questions: (1) In Nick's code he shows: let context = self.newSwiftContext(from: Trip.self) can you say more about this method newSwiftContext(). How should we implement it to fetch a new context from the same container? (2) In Core Data we usually read from the main context but write to a child of main context off the main thread and then the parent is notified it needs to refresh. How do we do that with SwiftData or is that managed for us? Thanks, Daniel
3
3
3k
Aug ’23
Migration Questions CoreData to SwiftData
Hi, I am looking to migrate a CoreData app which uses CloudKit to SwiftData and have two (for now) migration questions. (1) Many of the attributes have the Optional checkbox checked in the xcdatamodeld file. The corresponding SwiftData properties are marked as Optional (?) but are never not initialized to an actual value. Can I remove the ? from those property types or am I required to do this as a migration? (1a) If I'm required to do this as a migration, is this a custom migration or can I do it as a light migration. (2) I have several Int16 in the Core Data model which I'd like to make Ints in the SwiftData model. Is this a migration? Is it a custom one or can the migration make the conversion. Thank you, Daniel
1
0
1.3k
Jul ’23
MusicAlbums simulator recommendation
Hi, MusicKit is a particularly good example for teaching aspects of async coding. The API does many things very nicely. It would be nice if developers could access their Music libraries in the simulator as that would make this API a great teaching tool. Requiring new devs to deploy an app to a device in a workshop is a bit much for some. I have no idea if this is something you can practically enable - but I thought it was worth suggesting. Thanks, Daniel
2
0
1.9k
Aug ’22
Music preview with MusicKit
Hi, I apologize for asking so many questions. I don't know that I'll ever ship anything but I'm experimenting with an old fashioned radio station like we used to program in the old top forties days. I'd like to allow the music programmers to listen to sets that they're building by skimming through songs - does MusicKit or any part of the API allow us to access the Music preview for a given song? i.e. - I want users with a subscription to be able to hear the 30 s preview that you can find in Music. I may be requesting that a Song have a preview as one of its playing mode options. Thank you, Daniel
9
0
4.6k
Apr ’22
MusicKit and Export Compliance
Hi, I'm answering the questions on whether or not my app uses encryption. Do calls using MusicKit mean that I have to answer "Yes"? Do these calls qualify for the exemptions referred to in the App Store question: "Does your app qualify for any of the exemptions provided in Category 5, Part 2 of the U.S. Export Administration Regulations?"
1
0
1.5k
Feb ’22
Can you explain canBecomeSubscriber
Based on a twitter thread this morning I want to be clear that before asking this I did run test code... What does MusicKit's MusicSubscription canBecomeSubscriber indicate. It is returning false for me - is that because I'm already a subscriber? The docs say it is "A capability that allows your app to present subscription offers for Apple Music." So will it return false if the user is already a subscriber? Is there a condition in which it returns false if your user is not already a subscriber? (i.e. is there any reason they can't subscribe from my app using the .musicSubscriptionOffer() modifier? Thank you, Daniel
2
0
1.4k
Feb ’22
Using MusicItemID
I have two questions related to the id for Playlist and Song. (1) There are two properties named id in each type. One is defined to be a MusicItemID and one is an ObjectIdentifier. How does one distinguish between them? What is the difference in how we are two use them. (2) Suppose the user has built a custom playlist of Song items in my app. Should I persist the MusicItemID and then retrieve the Song later using a MusicCatalogResourceRequest? It's a fun API to play with but there's little documentation. Thank you, Daniel
1
0
1.3k
Dec ’21
How do you style the custom markdown elements
In the "What's new in Foundation" and "What's new in SwiftUI" talks there were examples of creating custom Attributed String styles. The example shown was for a rainbow style. They showed creating the style, serializing the style, using the style in a String - but did not show how to actually render the text in the rainbow style. How is that part done in SwiftUI. ie if I have Text("My fake example of ^[a custom style](customStyle: redAndEmphasized).") How would i create the piece that renders "a custom style" with foregroundColor red and a heavy font? Thanks, Daniel
Replies
2
Boosts
0
Views
2.7k
Activity
Sep ’23
Context outside of SwiftUI Views
In a SwiftUI view it is easy to pull mainContext out of the Environment (thanks for that). I have two questions: (1) In Nick's code he shows: let context = self.newSwiftContext(from: Trip.self) can you say more about this method newSwiftContext(). How should we implement it to fetch a new context from the same container? (2) In Core Data we usually read from the main context but write to a child of main context off the main thread and then the parent is notified it needs to refresh. How do we do that with SwiftData or is that managed for us? Thanks, Daniel
Replies
3
Boosts
3
Views
3k
Activity
Aug ’23
Migration Questions CoreData to SwiftData
Hi, I am looking to migrate a CoreData app which uses CloudKit to SwiftData and have two (for now) migration questions. (1) Many of the attributes have the Optional checkbox checked in the xcdatamodeld file. The corresponding SwiftData properties are marked as Optional (?) but are never not initialized to an actual value. Can I remove the ? from those property types or am I required to do this as a migration? (1a) If I'm required to do this as a migration, is this a custom migration or can I do it as a light migration. (2) I have several Int16 in the Core Data model which I'd like to make Ints in the SwiftData model. Is this a migration? Is it a custom one or can the migration make the conversion. Thank you, Daniel
Replies
1
Boosts
0
Views
1.3k
Activity
Jul ’23
MusicAlbums simulator recommendation
Hi, MusicKit is a particularly good example for teaching aspects of async coding. The API does many things very nicely. It would be nice if developers could access their Music libraries in the simulator as that would make this API a great teaching tool. Requiring new devs to deploy an app to a device in a workshop is a bit much for some. I have no idea if this is something you can practically enable - but I thought it was worth suggesting. Thanks, Daniel
Replies
2
Boosts
0
Views
1.9k
Activity
Aug ’22
Music preview with MusicKit
Hi, I apologize for asking so many questions. I don't know that I'll ever ship anything but I'm experimenting with an old fashioned radio station like we used to program in the old top forties days. I'd like to allow the music programmers to listen to sets that they're building by skimming through songs - does MusicKit or any part of the API allow us to access the Music preview for a given song? i.e. - I want users with a subscription to be able to hear the 30 s preview that you can find in Music. I may be requesting that a Song have a preview as one of its playing mode options. Thank you, Daniel
Replies
9
Boosts
0
Views
4.6k
Activity
Apr ’22
MusicKit and Export Compliance
Hi, I'm answering the questions on whether or not my app uses encryption. Do calls using MusicKit mean that I have to answer "Yes"? Do these calls qualify for the exemptions referred to in the App Store question: "Does your app qualify for any of the exemptions provided in Category 5, Part 2 of the U.S. Export Administration Regulations?"
Replies
1
Boosts
0
Views
1.5k
Activity
Feb ’22
Can you explain canBecomeSubscriber
Based on a twitter thread this morning I want to be clear that before asking this I did run test code... What does MusicKit's MusicSubscription canBecomeSubscriber indicate. It is returning false for me - is that because I'm already a subscriber? The docs say it is "A capability that allows your app to present subscription offers for Apple Music." So will it return false if the user is already a subscriber? Is there a condition in which it returns false if your user is not already a subscriber? (i.e. is there any reason they can't subscribe from my app using the .musicSubscriptionOffer() modifier? Thank you, Daniel
Replies
2
Boosts
0
Views
1.4k
Activity
Feb ’22
Using MusicItemID
I have two questions related to the id for Playlist and Song. (1) There are two properties named id in each type. One is defined to be a MusicItemID and one is an ObjectIdentifier. How does one distinguish between them? What is the difference in how we are two use them. (2) Suppose the user has built a custom playlist of Song items in my app. Should I persist the MusicItemID and then retrieve the Song later using a MusicCatalogResourceRequest? It's a fun API to play with but there's little documentation. Thank you, Daniel
Replies
1
Boosts
0
Views
1.3k
Activity
Dec ’21