Swiftpack.co - maukur/DialogService as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by maukur.
maukur/DialogService 3.0.0
DialogService from ViewModels for SwiftUI
⭐️ 3
🕓 3 years ago
iOS
.package(url: "https://github.com/maukur/DialogService.git", from: "3.0.0")

DialogService

A Dialog Service for easy way using from buisness logic layer for UIKit and SwiftUI

Setup with Swift PM

  1. Add ‘DialogService’ to your Project’s ‘Swift Packages’ section.
  2. Input desired version.
  3. Adding package dependencies to your App.

Usage

Initialization

@main
struct thisorthatApp: App {
  init() {
    DialogService.initialize(getTopViewController: getTopViewController)
  }
  
  func getTopViewController() -> UIViewController? {
    return UIApplication.shared.windows.first?.rootViewController;
  }
} 

Using

class PurchaseViewModel: DialogProtocol {
  func shopError() {
    showAlert(title: "Error", message: "Do you want continiue", action: "Yes", cancelAnction: "No") { result in
      if result {
         foo()
      }
      else {
         bar()
      }
    }
  }
}

Sample

alt text alt text

GitHub

link
Stars: 3
Last commit: 3 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Dependencies

Release Notes

3.0.0
3 years ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics