Update 1.3.1

Update 1.3.1

Maintained by Alexandre.



Update 1.3.1

  • By
  • Alexandre

Update

Description

Update is an observable object for SwiftUI that checks if new version of app is available.

  • Initialize with one or two buttons alert.
  • Supported languages: English, Catalan, Chinese, Croatian, Czech, Danish, Dutch, Finnish, French, German, Greek, Hindi, Hungarian, Indonesian, Italian, Japanese, Korean, Malay, Norwegian, Polish, Portuguese, Romanian, Russian, Slovak, Spanish, Swedish, Thai, Turkish, Ukrainian and Vietnamese.

Installation

You want to add pod 'Update', '~> 1.3' similar to the following to your Podfile:

target 'MyApp' do
    pod 'Update', '~> 1.3'
end

Then run a pod install inside your terminal, or from CocoaPods.app.

Requirements

iOS 13.0 Swift 5.0

Visual

English Available

Usage

public class Update: ObservableObject, Fetchable

init(Option)
import Update

class SceneDelegate: UIResponder, UIWindowSceneDelegate {

    var window: UIWindow?

    func scene(
        _ scene: UIScene,
        willConnectTo session: UISceneSession,
        options connectionOptions: UIScene.ConnectionOptions
    ) {

        if let windowScene = scene as? UIWindowScene {
            
            let window = UIWindow(windowScene: windowScene)
            let contentView = ContentView()
            let update = Update(.available)

            window.rootViewController = UIHostingController(rootView: contentView
                .environmentObject(update)
            )
            self.window = window
            window.makeKeyAndVisible()
        }
    }
}
import Update

struct ContentView: View {
    
    @EnvironmentObject private var update: Update
    
    var body: some View {

        return EmptyView()
        .onAppear(perform: {
            
            self.update.fetch(from: Itunes.lookupURL)
        })
        .alert(isPresented: self.$update.showingAlert) { self.update.alert! }
    }
}

Support

Please file a github issue.

Roadmap

Support more languages.

License

MIT