A new generation of an AlertView
reactive programming UI framework with fluid design interface. Written in purely Swift. Adapted to Dark Mode.
The example project is included in PokerCard.xcworkspace
, and it contains various examples you can use and modify as you like.
PokerCard fully supports Dark Mode now on iOS 13+.
You do not need extra work to support it at all. All the work is already done for you.
- iOS 10+
- Xcode 11+
- Swift 5+
⚠️ PokerCard has not been tested and there is a lack of UITest and other testing cases. This is a pre-release version only⚠️
PokerCard is compatible with Swift 5 as of pre-release 0.1.0.
CocoaPods is a dependency manager for Cocoa projects. To integrate PokerCard into your Xcode project using CocoaPods, specify it in your Podfile
:
pod 'PokerCard'
Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks. To integrate into your Xcode project using Carthage, specify it in your Cartfile
:
github "iWeslie/PokerCard"
The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift
compiler and Xcode 11+ has integrated it. To add PokerCard as a dependency, navigate to the menu bar, click File/Swift Packages/Add Package Dependency…
and then input the repository URL:
https://github.com/iWeslie/PokerCard
If you prefer not to use any of the aforementioned dependency managers, you can integrate Alamofire into your project manually.
-
Open up Terminal,
cd
into your top-level project directory, suppose your project has already been controlled by git. Then, add PokerCard as a git submodule by running the following command:$ git submodule add https://github.com/iWeslie/PokerCard.git
-
Open the new
PokerCard
folder, and drag theAlamofire.xcodeproj
into the Project Navigator of your application's Xcode project.It should appear nested underneath your application's blue project icon. Whether it is above or below all the other Xcode groups does not matter.
-
Next, select your application project in the Project Navigator (blue project icon) to navigate to the target configuration window and select the application target under the "Targets" heading in the sidebar.
-
In the tab bar at the top of that window, open the "General" panel.
-
Click on the
+
button under the “Frameworks, Libraries and Embedded Content" section. -
You will see
PokerCard.xcodeproj
folders aPokerCard.framework
. Select it and clickAdd
. -
And that's it!
// present a poker card
PokerCard.showAlert(title: "Please notice").confirm {
// do something ...
}
PokerCard.showAlert(title: "Please notice", detail: "Here is some descripttion ...")
Or if you want some customization on the Confirm
button.
let detailInfo = "You may configure the alert it as following"
PokerCard.showAlert(title: "The Alert Title", detail: detailInfo)
.confirm(title: "Done", style: .default, cancelTitle: "Cancel") {
// do something
}
PokerCard.showInput(title: "Please input your name")
.confirm(title: "Done", style: .color(.systemPink), cancelTitle: "Cancel") { inputText in
print("Hey, \(inputText)!")
}
let warningInfo = "Some long paragraph of text"
PokerCard.showPromotion(title: "Notice", promotion: warningInfo)
// modify the promotion preference
.appearance(promotionStyle: .color(.systemPink))
// validate the input string
.validate { $0.count == 9 }
// confirm handler
.confirm { inputText in
print(inputText)
}
// This is only available for iOS 13+
PokerCard.showAppearanceOptions()
.config(light: {
print("light selected")
}, dark: {
print("dark selected")
}) {
print("auto selected")
}
.setTitles(title: "Appearance", light: "Light", dark: "Dark", auto: "Auto")
// add an option for appearance configuration
.addOption(title: "Show Background Image", isChecked: false) { trigger in
print("is showing background image: \(trigger)")
// do some stuff...
}
// you can leave the image nil for `Email` and `Message` option in iOS 13+, it will use sfsymbol automatically.
let emailOption = PKContactOption(type: .email(["[email protected]"]), image: UIImage(named: "mail"), title: "Email")
let messageOption = PKContactOption(type: .message(["[email protected]"]), image: UIImage(named: "message"), title: "iMessage")
// Other images should be added into `Assets.xcassets`
let githubOption = PKContactOption(type: .github("iWeslie"), image: UIImage(named: "github"), title: "GitHub")
PokerCard.showContacts()
.setTitle("Contact Us")
.addOptions([emailOption, messageOption, githubOption], on: self)
PokerCard.showLanguagePicker()
.config(en: {
print("en selected")
}, zh: {
print("zh selected")
}) {
print("follow system")
}
.setTitle("Select Language")
// These images should also be added into `Assets.xcassets`. You may check it out in Example project.
.setImages(en: UIImage(named: "enLang")!, zh: UIImage(named: "zhLang")!, auto: UIImage(named: "autoLang")!, checkmark: UIImage(named: "checkmark")!)
Documentation will be available soon. You may view the usage inside Xcode.
Weslie Chen, [email protected]. WeChat: weslie-chen
PokerCard is available under the MIT license. See the LICENSE file for more info.