Post

Replies

Boosts

Views

Activity

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
2.5k
Jul ’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
1k
Jul ’23
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.3k
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.2k
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.1k
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
2
0
2.3k
Nov ’21
MusicKit business questions
Hi, Given yesterday's announcement of a new subscription I have some business/permissions questions about apps built on MusicKit. If this is not the place to ask them can you please direct me to where would be more appropriate. (1) When we test to see if someone has a subscription, is there any difference between a Voice subscription and a regular subscription? i.e. will we be able to query and vend any song in Apple Music if the user has a Voice sub the same way we can if they have an individual or family sub? (2) Can our app require that they have some sort of subscription or do we have to provide functionality even if they don't? (3) If I read the agreement correctly, we can't store music for offline listening but we can create and use a playlist in Music. Is there a way to prompt the user to download the music to this playlist? Thank you, Daniel
3
0
1.3k
Oct ’21
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.7k
Jul ’21
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
3.7k
Jul ’21
ArtworkImage is not discoverable
Hi, I wanted to display the artwork for a playlist and was puzzled at the Artwork API. In Apple's sample code they use ArtworkImage so I checked the docs for it. ArtworkImage is not listed under structs in MusicKit. If you search for it you can find it - but you have to know it's there. It should be added to the TOC for MusicKit (I would have wrongly assumed this was done automatically) and there should be a link from Artwork to ArtworkImage with an explanation of some sort. FB9353976 Thanks, Daniel
1
0
962
Jul ’21
Non-Apple Playlists in MusicKit
Hi, I'm sorry if this is something I should know, but if I make a music catalog search such as: let request = MusicCatalogSearchRequest(term: searchTerm,                               types: [Playlist.self]) I get the Apple Music playlists containing the searchTerm (say Rock, Rap, Jazz,...) How do I get the non Apple playlists say the ones curated by Blue Note? Thanks, Daniel
2
0
1.2k
Jul ’21