Work in progress iOS

Installing

The iOS design system for the NHS app is available as a Swift package.

To use it, you’ll need to add the package as dependency to your prototype or production app.

Creating a GitHub personal access token

At the moment, because the package is a private repository, you'll need to create a GitHub personal access token to be able to access the code.

  1. Go to personal access tokens on GitHub.
  2. Select Generate new token.
  3. Give the token a name – this can be the name of your prototype or anything brief and descriptive.
  4. Set 'resource owner' to NHSDigital.
  5. Set the expiration to 366 days.
  6. Select Only select repositories, then search for nhsapp-design-system-ios and select that.
  7. Select Add permissions and search for 'Contents' and select that.
  8. Generate the token, and then copy it somewhere safe. You will need it in the next step.

In the future, these steps will no longer be required once the repository is public.

Adding the package

In Xcode:

  1. Go to: File → Add Package Dependencies.
  2. Enter the repository URL: https://github.com/NHSDigital/nhsapp-design-system-ios. You'll need to add your personal access token to view it.
  3. Set the 'Dependency Rule' to Up to Next Major Version' with a lower bound of 1.0.0. This picks up patch and minor updates (1.0.1, 1.1.0, …) automatically while holding back any breaking 2.0.0 release until you're ready. Select 'Add Package'.
  4. In the dialog box, under 'Add to Target' change 'None' to your app name. Then select Add Package again.

After you've added the package, there's one more thing to check, otherwise your app might crash when you try to run it.

  1. Select your app's target (not the package) in Xcode.
  2. Go to the 'General' tab.
  3. Scroll down to 'Frameworks, Libraries, and Embedded Content'.
  4. Find NHSDesignSystem in the list.
  5. Make sure it says 'Embed & Sign' next to it. If it says 'Do Not Embed', change it.

If you skip this step, your app will still build without any errors – but it will crash as soon as you try to open it on a phone.

Updating the package

Whenever there are changes made to the swift package, you'll need to update the package within your project.

To do this, go to File → Packages → Update to Latest Package Versions.