Snippets

  • Make SwiftData Codable

    When moving from Core Data to Swift Data, it’s not obvious how to make the data model codable, a must for reading or writing JSON files or API’s to/from the persistent storage. A way to do it is to manually add Codekeys so that the @Model knows that the data types are supported. Here is

    Read more ….


  • Show the device

    To show what kind of device the user have, you can add this code to a swift file In the view you can now add The deviceType.iDevice will show “iPhone”, “iPad” or “iPod” etc. as String

    Read more ….