Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import Foundation
- extension URL {
- /// Returns an url for App Store app.
- ///
- /// Example: [itms-apps://itunes.apple.com/app/id1434568484?action=write-review]()
- ///
- /// - Parameters:
- /// - id: The id of the app.
- /// - openReviewPage: The flag for review page opening. False by default.
- /// - Returns: an url for App Store app.
- public static func appStoreURL(forAppWithID id: String, openReviewPage: Bool = false) -> URL? {
- var components = URLComponents()
- components.scheme = "itms-apps"
- components.host = "itunes.apple.com"
- components.path = "/app/id" + id
- if openReviewPage {
- components.queryItems = [URLQueryItem(name: "action", value: "write-review")]
- }
- return components.url
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement