How to get your iOS or Mac app's name with Swift code

When developing your iOS or Mac app, you might want to access your app's name programmatically in your code instead of hardcoding it's name.

To get the app's display name you can use the following code:

Bundle.main.infoDictionary?["CFBundleDisplayName"]

Now if you decide to change your app's name, you won't need to use find and replace to change code throughout your codebase.

Home Knowledge Base Support Download