NotPaid - SwiftUI
Client did not pay?
Add opacity to any SwiftUI View and decrease it every day until their app completely fades away. Set a due date and customize the number of days you offer them until the app is fully vanished.
Requirements
Requires iOS 13.0+
Installation
Swift Package Manager
The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift
compiler.
Once you have your Swift package set up, adding NotPaid as a dependency is as easy as adding it to the dependencies
value of your Package.swift
.
dependencies: [
.package(url: "https://github.com/vfrascello/not-paid-ios.git")
]
Manually
If you prefer not to use any of the Swift pacakage manager, you can simply copy NotPaid.swift
into your project.
Usage
- Import the package.
import NotPaid
- Create a
NotPaidSettings
object, passing in adueDate
and adeadline
(default is 60 days) in yourApp
file or rootView
.
let settings = NotPaidSettings(dueDate: yourDueDate, deadline: yourDeadline)
where yourDueDate
is a Date
object and yourDeadline
is an Int
representing the number of days after due date until zero opacity.
- Use the
.environmentObject(_ object:)
modifier to apply your settings to the environment.
var body: some Scene {
WindowGroup {
ContentView().environmentObject(settings)
}
}
- Apply
NotPaid
using.notPaid()
on anyView
.NotPaid
will modify theopacity
to the appropriate level.
VStack{
Text("Hello, world!")
Image(systemName: "person.fill")
}
.notPaid()
P.S. If you want the ability to remotely enable/disable NotPaid
, you can adjust settings.isActive
to your remote configuration of choice.
Acknowledgements
Based on the original Javascript implementation by @kleampa.
A Wordpress plugin is also available here.
There's also an Android version available here.
There's also an Windows Forms version available here.
Flutter version available here.
Author
Inspired from twitter (@riklomas) Made by Vincent Frascello (@vfrascello), USA