SwiftyUpdateKit is a framework for iOS and macOS.

Overview

SwiftyUpdateKit

CI

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.

Supports

OS version
iOS 13.0+
macOS 10.15+

Requires

  • Swift 5+

Installation

Carthage (recommended)

SwiftyUpdateKit is available through Carthage. To install it, simply add the following line to your Cartfile:

github "HituziANDO/SwiftyUpdateKit"

CocoaPods

SwiftyUpdateKit is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "SwiftyUpdateKit"

Usage

Import Framework

import SwiftyUpdateKit

Initialize

To initialize this framework, you use SUK.applicationDidFinishLaunching method in application(_:,didFinishLaunchingWithOptions:) method (macOS: applicationDidFinishLaunching(_:) method) of AppDelegate. See following:

iTunesID is 1234567890 iTunesID: "1234567890", // The App Store URL of your app. storeURL: "https://apps.apple.com/app/your-app/id1234567890", // The country code used by iTunes Search API. // See http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 for a list of ISO Country Codes. country: "us", // The method to compare the app version. versionCompare: VersionCompare(), // The update alert's title. updateAlertTitle: "Released new version!", // The update alert's message. updateAlertMessage: "Please update the app. Please refer to the App Store for details of the update contents.", // The update button's label. updateButtonTitle: "Update", // The remind-me-later button's label. If nil is specified, the button is hidden. // That is, you can force a user to update because it cannot be canceled. remindMeLaterButtonTitle: "Remind me later" ) SUK.applicationDidFinishLaunching(withConfig: config) ">
let config = SwiftyUpdateKitConfig(
    // Current app version.
    version: Bundle.main.infoDictionary!["CFBundleShortVersionString"] as! String,
    // iTunes ID.
    // e.g.) The App Store URL: "https://apps.apple.com/app/sampleapp/id1234567890" -> iTunesID is 1234567890
    iTunesID: "1234567890",
    // The App Store URL of your app.
    storeURL: "https://apps.apple.com/app/your-app/id1234567890",
    // The country code used by iTunes Search API.
    // See http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 for a list of ISO Country Codes.
    country: "us",
    // The method to compare the app version.
    versionCompare: VersionCompare(),
    // The update alert's title.
    updateAlertTitle: "Released new version!",
    // The update alert's message.
    updateAlertMessage: "Please update the app. Please refer to the App Store for details of the update contents.",
    // The update button's label.
    updateButtonTitle: "Update",
    // The remind-me-later button's label. If nil is specified, the button is hidden.
    // That is, you can force a user to update because it cannot be canceled.
    remindMeLaterButtonTitle: "Remind me later"
)
SUK.applicationDidFinishLaunching(withConfig: config)

Quick Usage

To check whether new version is released, you use SUK.checkVersion method in viewDidAppear method of the view controller. See following:

SUK.checkVersion(VersionCheckConditionAlways(), newRelease: { [weak self] newVersion, releaseNotes, firstUpdated in
    guard let self = self else { return }
    SUK.showReleaseNotes(from: self, text: releaseNotes, version: newVersion)
}) {
    SUK.requestReview(RequestReviewConditionAlways())
}

First, this code shows the update alert if current app version is old.

Next, when new app version is installed, it shows the release notes of your app's the App Store page.

Finally, if the app version is latest and the release notes have already shown, it requests the review about your app.

Use custom UI

You can use custom UI to show the update alert and the release notes. See following:

SUK.checkVersion(VersionCheckConditionAlways(), update: { [weak self] newVersion, releaseNotes in
    guard let self = self else { return }
    // This closure is called when current app version is old.
    // Show custom update alert: present your view controller or add your view for the update alert.
}, newRelease: { [weak self] newVersion, releaseNotes, firstUpdated in
    guard let self = self else { return }
    // Show custom release notes: present your view controller or add your view to show the release notes.
}) {
    // noop
}

To 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:

SUK.openAppStore()

Reset the status

Resets the status: stored date of version check condition, stored date of request review condition, and stored app version for the release notes.

For example, you may use SUK.reset method during testing and development.

SUK.reset()

Version Comparison Method

Default version comparison method refers to here. If you need another comparison method, you implement the VersionComparable protocol and set it to versionCompare argument in the SwiftyUpdateKitConfig.

API Reference

To make the document of this framework, you run following command on the Terminal. This script depends on jazzy.

./make_docs.sh
You might also like...
An enhancement built on top of Foundation Framework and XCTest.

Beton is a Swift library built on top of the Foundation framework, that provides an additional layer of functionality, including easy localization, performance test measurement support, and convenience functionality. For us, Beton is primarily, but not exclusively, useful for server-side Swift engineering.

Add “Launch at Login” functionality to your macOS app in seconds
Add “Launch at Login” functionality to your macOS app in seconds

LaunchAtLogin Add “Launch at Login” functionality to your macOS app in seconds It's usually quite a convoluted and error-prone process to add this. No

macOS system library in Swift

SystemKit A macOS system library in Swift based off of libtop, from Apple's top implementation. For an example usage of this library, see dshb, a macO

macOS utility for converting fat-frameworks to SPM-compatible XCFramework with arm64-simulator support
macOS utility for converting fat-frameworks to SPM-compatible XCFramework with arm64-simulator support

xcframework-maker macOS utility for converting fat-frameworks to SPM-compatible XCFramework with arm64-simulator support. 📝 Description make-xcframew

ALO sync allows you to sync resources form an ALO endpoint to your macOS file system.
ALO sync allows you to sync resources form an ALO endpoint to your macOS file system.

ALO sync allows you to sync resources form an ALO endpoint to your macOS file system. Prerequisites macOS 11 No support for search* No suppor

Simple utility to change macOS Big Sur menu bar color by appending a solid color or gradient rectangle to a wallpaper image
Simple utility to change macOS Big Sur menu bar color by appending a solid color or gradient rectangle to a wallpaper image

Change menu bar color in macOS Big Sur Simple utility to change macOS Big Sur menu bar color by appending a solid color or gradient rectangle to a wal

This is a Swift package with support for macOS that allows to start Java Jar's with the default or a custom JVM.

Jar.swift jar runner for macos Jar.swift is created and maintaned with ❥ by Sascha Muellner. What? This is a Swift package with support for macOS that

A simple macOS utility that can be used to control the behaviour of Bose QC35 Headphones straight from the menu bar.

bose-macos-utility A simple macOS utility that can be used to control the behaviour of Bose QC35 Headphones straight from the menu bar. Why Have you e

Hermes is a Swift 5 payload for macOS.

Hermes is a Swift 5 payload for macOS. This version currently supports Mythic 2.2.8 and will update as necessary. It will not work with Mythic 2.1 and lower.

Owner
Hituzi Ando
Hituzi Ando
Easy CBOR encoding and decoding for iOS, macOS, tvOS and watchOS.

CBORCoding CBORCoding is a lightweight framework containing a coder pair for encoding and decoding Codable conforming types to and from CBOR document

Joe Newton 23 Nov 8, 2022
Versions tracker for your iOS, macOS, and tvOS app

VersionTrackerSwift VersionTrackerSwift is a versions / builds tracker to know which version has been installed by a user. Usage In your ApplicationDe

Tom Baranes 82 Oct 5, 2022
A cross-platform library of Swift utils to ease your iOS | macOS | watchOS | tvOS and Linux development.

Mechanica A library of Swift utils to ease your iOS, macOS, watchOS, tvOS and Linux development. Requirements Documentation Installation License Contr

Alessandro 28 Aug 28, 2022
Zip - A Swift framework for zipping and unzipping files. Simple and quick to use. Built on top of minizip.

Zip A Swift framework for zipping and unzipping files. Simple and quick to use. Built on top of minizip. Usage Import Zip at the top of the Swift file

Roy Marmelstein 2.3k Jan 3, 2023
A macOS application displaying the thermal, voltage and current sensor values.

Sensors About A macOS application displaying the thermal, voltage and current sensor values. License Project is released under the terms of the MIT Li

Jean-David Gadina 82 Jan 3, 2023
XMachOViewer is a Mach-O viewer for Windows, Linux and MacOS

MachO file viewer/editor for Windows, Linux and macOS. Heuristic scan String viewer Hex viewer Disasm viewer(x86/64,ARM,PPC,m68k) Entropy viewer Hash

Hors 505 Dec 20, 2022
LanguageList for SwiftUI supporting iOS/macOS/tvOS

LanguageList for iOS, macOS and tvOS LanguageList is created and maintaned with ❥ by Sascha Muellner. What? This is a SwiftUI package with support for

Swift Package Repository 2 Jan 26, 2022
💻 A fast and flexible O(n) difference algorithm framework for Swift collection.

A fast and flexible O(n) difference algorithm framework for Swift collection. The algorithm is optimized based on the Paul Heckel's algorithm. Made wi

Ryo Aoyama 3.3k Jan 4, 2023
RandomKit is a Swift framework that makes random data generation simple and easy.

RandomKit is a Swift framework that makes random data generation simple and easy. Build Status Installation Compatibility Swift Package Manager CocoaP

Nikolai Vazquez 1.5k Dec 29, 2022