Skip to content

Commit fbf012d

Browse files
committed
Updated UIApplication extension.
1 parent 19d0fc2 commit fbf012d

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

Sources/SparrowKit/UIKit/Extensions/UIApplicationExtension.swift

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,34 +22,46 @@
2222
#if canImport(UIKit) && (os(iOS) || os(tvOS))
2323
import UIKit
2424

25-
public extension UIApplication {
25+
extension UIApplication {
2626

2727
/**
2828
SparrowKit: Bundle display name from plist.
2929
*/
30-
var displayName: String? {
30+
open var displayName: String? {
3131
return Bundle.main.object(forInfoDictionaryKey: "CFBundleDisplayName") as? String
3232
}
3333

3434
/**
3535
SparrowKit: Bundle identifier from plist.
3636
*/
37-
var bundleIdentifier: String? {
37+
open var bundleIdentifier: String? {
3838
return Bundle.main.bundleIdentifier
3939
}
4040

4141
/**
4242
SparrowKit: Bundle version from plist.
4343
*/
44-
var version: String? {
44+
open var version: String? {
4545
return Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String
4646
}
4747

4848
/**
4949
SparrowKit: Bundle number from plist.
5050
*/
51-
var buildNumber: String? {
51+
open var buildNumber: String? {
5252
return Bundle.main.object(forInfoDictionaryKey: kCFBundleVersionKey as String) as? String
5353
}
54+
55+
/**
56+
SparrowKit: Open App Settings.
57+
*/
58+
public func openSettings() {
59+
DispatchQueue.main.async {
60+
guard let settingsUrl = URL(string: UIApplication.openSettingsURLString) else { return }
61+
if UIApplication.shared.canOpenURL(settingsUrl) {
62+
UIApplication.shared.open(settingsUrl, completionHandler: { _ in })
63+
}
64+
}
65+
}
5466
}
5567
#endif

0 commit comments

Comments
 (0)