{"id":21089768,"url":"https://github.com/hituziando/swiftyupdatekit","last_synced_at":"2025-05-16T13:30:53.264Z","repository":{"id":43150111,"uuid":"414870790","full_name":"HituziANDO/SwiftyUpdateKit","owner":"HituziANDO","description":"SwiftyUpdateKit is a framework for iOS and macOS. This framework supports for a user to update your app when new app version is released on the App Store.","archived":false,"fork":false,"pushed_at":"2024-04-16T08:50:02.000Z","size":2521,"stargazers_count":8,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-09-17T21:07:15.870Z","etag":null,"topics":["ios","macos","swift","ui","update"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HituziANDO.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2021-10-08T06:24:56.000Z","updated_at":"2024-06-27T06:44:58.000Z","dependencies_parsed_at":"2023-10-16T18:40:38.023Z","dependency_job_id":"dd51193c-fb2b-46c2-b1a0-4eceb5b07089","html_url":"https://github.com/HituziANDO/SwiftyUpdateKit","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HituziANDO%2FSwiftyUpdateKit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HituziANDO%2FSwiftyUpdateKit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HituziANDO%2FSwiftyUpdateKit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HituziANDO%2FSwiftyUpdateKit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HituziANDO","download_url":"https://codeload.github.com/HituziANDO/SwiftyUpdateKit/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225430847,"owners_count":17473258,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ios","macos","swift","ui","update"],"created_at":"2024-11-19T21:31:17.600Z","updated_at":"2025-05-16T13:30:53.258Z","avatar_url":"https://github.com/HituziANDO.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SwiftyUpdateKit\n\n![release](https://img.shields.io/github/v/release/HituziANDO/SwiftyUpdateKit?display_name=tag)\n![Pod Platform](https://img.shields.io/cocoapods/p/SwiftyUpdateKit.svg?style=flat)\n[![Pod Version](https://img.shields.io/cocoapods/v/SwiftyUpdateKit.svg?style=flat)](https://cocoapods.org/pods/SwiftyUpdateKit)\n[![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![Swift Package Manager compatible](https://img.shields.io/badge/Swift%20Package%20Manager-compatible-brightgreen.svg)](https://github.com/apple/swift-package-manager)\n[![CI](https://github.com/HituziANDO/SwiftyUpdateKit/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/HituziANDO/SwiftyUpdateKit/actions/workflows/ci.yml)\n\u003cimg src=\"https://raw.githubusercontent.com/HituziANDO/SwiftyUpdateKit/main/docs/ios/badge.svg\"\u003e\n\nSwiftyUpdateKit is a framework for iOS and macOS. This framework supports for a user to update your app when new app version is released on the App Store.\n\n## Supports\n\n|OS|version|\n|:-:|:-:|\n|iOS|13.0+|\n|macOS|10.15+|\n\n## Requires\n\n- Swift 5+\n\n## Installation\n\n### Swift Package Manager\n\nSwiftyUpdateKit is available through Swift Package Manager. To install it using Xcode, specify the git URL for SwiftyUpdateKit.\n\t\n```\nhttps://github.com/HituziANDO/SwiftyUpdateKit.git\n```\n\n### Carthage\n\nSwiftyUpdateKit is available through [Carthage](https://github.com/Carthage/Carthage). To install it, simply add the following line to your Cartfile:\n\n```\ngithub \"HituziANDO/SwiftyUpdateKit\"\n```\n\n### CocoaPods\n\nSwiftyUpdateKit is available through [CocoaPods](http://cocoapods.org). To install it, simply add the following line to your Podfile:\n\t\n```ruby\npod \"SwiftyUpdateKit\"\n```\n\n## Usage\n\n### Import Framework\n\n```swift\nimport SwiftyUpdateKit\n```\n\n### Initialize\n\nTo initialize this framework, you use `SUK.initialize` method in `application(_:,didFinishLaunchingWithOptions:)` method (macOS: `applicationDidFinishLaunching(_:)` method) of AppDelegate. See following:\n\n```swift\nlet config = SwiftyUpdateKitConfig(\n    // Current app version.\n    version: Bundle.main.infoDictionary![\"CFBundleShortVersionString\"] as! String,\n    // iTunes ID.\n    // e.g.) The App Store URL: \"https://apps.apple.com/app/sampleapp/id1234567890\" -\u003e iTunesID is 1234567890\n    iTunesID: \"1234567890\",\n    // The App Store URL of your app.\n    storeURL: \"https://apps.apple.com/app/your-app/id1234567890\",\n    // The country code used by iTunes Search API.\n    // See http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 for a list of ISO Country Codes.\n    country: \"us\",\n    // The method to compare the app version.\n    versionCompare: VersionCompare(),\n    // The update alert's title.\n    updateAlertTitle: \"Released new version!\",\n    // The update alert's message.\n    updateAlertMessage: \"Please update the app. Please refer to the App Store for details of the update contents.\",\n    // The update button's label.\n    updateButtonTitle: \"Update\",\n    // The remind-me-later button's label. If nil is specified, the button is hidden.\n    // That is, you can force a user to update because it cannot be canceled.\n    remindMeLaterButtonTitle: \"Remind me later\",\n    // (Optional) The count of retry when iTunes Search API failed. Default value is 2.\n    retryCount: 2,\n    // (Optional) Retries iTunes Search API after this delay in seconds. Default value is 1 second.\n    retryDelay: 1,\n    // (Optional) If true, the database is in development environment.\n    // Otherwise it is for production environment.\n    // Must set false when release your app.\n    development: {\n        #if DEBUG\n        return true\n        #else\n        return false\n        #endif\n    }()\n)\nSUK.initialize(withConfig: config)\n```\n\n### Quick Usage\n\nTo check whether new version is released, you use `SUK.checkVersion` method in `viewDidAppear` method of the view controller. See following:\n\n**iOS**\n\n```swift\nSUK.checkVersion(VersionCheckConditionAlways(), newRelease: { [weak self] newVersion, releaseNotes, firstUpdated in\n    guard let self = self else { return }\n    SUK.showReleaseNotes(from: self, text: releaseNotes, version: newVersion) {\n        // Release Notes has been closed.\n    }\n}) { [weak self] in\n    guard let self = self else { return }\n    SUK.requestReview(RequestReviewConditionAlways(), in: self.view)\n}\n```\n\n**macOS**\n\n```swift\nSUK.checkVersion(VersionCheckConditionAlways(), newRelease: { [weak self] newVersion, releaseNotes, firstUpdated in\n    guard let self = self else { return }\n    SUK.showReleaseNotes(from: self, text: releaseNotes, version: newVersion) {\n        // Release Notes has been closed.\n    }\n}) { [weak self] in\n    guard let self = self else { return }\n    SUK.requestReview(RequestReviewConditionAlways(), in: self)\n}\n```\n\nFirst, this code shows the update alert if current app version is old.\n\n\u003cimg src=\"./readme-images/update_alert.png\" width=\"200\"\u003e\n\nNext, when new app version is installed, it shows the release notes of your app's the App Store page.\n\n\u003cimg src=\"./readme-images/release_notes.png\" width=\"200\"\u003e\n\nFinally, if the app version is latest and the release notes have already shown, it requests the review about your app.\n\n\u003cimg src=\"./readme-images/request_review.png\" width=\"200\"\u003e\n\n### Use custom UI\n\nYou can use custom UI to show the update alert and the release notes. See following:\n\n```swift\nSUK.checkVersion(VersionCheckConditionAlways(), update: { [weak self] newVersion, releaseNotes in\n    guard let self = self else { return }\n    // This closure is called when current app version is old.\n    // Show custom update alert: present your view controller or add your view for the update alert.\n}, newRelease: { [weak self] newVersion, releaseNotes, firstUpdated in\n    guard let self = self else { return }\n    // Show custom release notes: present your view controller or add your view to show the release notes.\n}) {\n    // noop\n}\n```\n\nTo show custom update alert, the view controller presents your view controller or adds your view for the update alert in `update` closure. To open the App Store page of your app, you use following method:\n\n```swift\nSUK.openAppStore()\n```\n\n### Reset the status\n\nResets the status: stored date of version check condition, stored date of request review condition, and stored app version for the release notes.\n\nFor example, you may use `SUK.reset` method during testing and development.\n\n```swift\nSUK.reset()\n```\n\n## Version Comparison Method\n\nDefault version comparison method refers to [here](https://github.com/HituziANDO/SwiftyUpdateKit/blob/main/Framework/Sources/VersionCompare.swift#L26). If you need another comparison method, you implement the `VersionComparable` protocol and set it to `versionCompare` argument in the SwiftyUpdateKitConfig.\n\n## API Reference\n\nTo make the document of this framework, you run following command on the Terminal. This script depends on [jazzy](https://github.com/realm/jazzy).\n\n```\njazzy -version\njazzy version: 0.14.3\n\n./make_docs.sh\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhituziando%2Fswiftyupdatekit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhituziando%2Fswiftyupdatekit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhituziando%2Fswiftyupdatekit/lists"}