Fetching App and Device Info in SwiftUI

DevTechie
DevTechie
Published in
5 min readNov 1, 2022

--

Fetching App and Device Info in SwiftUI

Finding out information about app or capability for device can sometimes be useful so today, we will build helper functions to fetch various features about app and device.

App Info

Apps support multiple scenes, depending upon the platform they are being rendered. UIApplication provides a property to check if current app supports multiple scenes or not so we will wrap it in a static function and use it in our view.

struct AppInfo {
static var supportsMultipleScene: Bool {
UIApplication.shared.supportsMultipleScenes
}
}

Similarly, we can check if app supports dynamic icon change capability.

struct AppInfo {
static var supportsMultipleScene: Bool {
UIApplication.shared.supportsMultipleScenes
}

static var supportsAlternateIcons: Bool {
UIApplication.shared.supportsAlternateIcons
}

}

We can check if ShakeToEdit is supported by the app.

struct AppInfo {
static var supportsMultipleScene: Bool {
UIApplication.shared.supportsMultipleScenes
}

static var supportsAlternateIcons: Bool {
UIApplication.shared.supportsAlternateIcons
}

static var supportsShakeToEdit: Bool {
UIApplication.shared.applicationSupportsShakeToEdit
}

--

--