Swiftpack.co - xattacker/RxRequiredPropertyChecker as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by xattacker.
xattacker/RxRequiredPropertyChecker 1.1.1
a RxSwift related component, help checking property has been filled
⭐️ 0
🕓 1 year ago
iOS
.package(url: "https://github.com/xattacker/RxRequiredPropertyChecker.git", from: "1.1.1")

RxRequiredPropertyChecker

a RxSwift Related component, help checking property has been filled

another congeneric project: https://github.com/xattacker/RequiredPropertyChecker (which implemented by Combine)

Demo Video

https://user-images.githubusercontent.com/33754378/131239984-9138ccfd-5525-4584-8b8c-712079140315.mp4

Installation

Cocoapods

RxRequiredPropertyChecker can be added to your project using CocoaPods 0.36 or later by adding the following line to your Podfile:

pod 'RxSwift'
pod 'RxCocoa'
pod 'RxRequiredPropertyChecker'

Swift Package Manager

To add RxRequiredPropertyChecker to a Swift Package Manager based project, add:

.package(url: "https://github.com/xattacker/RxRequiredPropertyChecker.git", .upToNextMajor(from: "1.1.1")),
.package(url: "https://github.com/ReactiveX/RxSwift.git", .upToNextMajor(from: "6.0.0")),

to your Package.swift files dependencies array.

How to use:

import RxRequiredPropertyChecker

// make the component implement protocol RequiredProperty
extension UITextField: RequiredProperty
{
    public var isFilled: Bool
    {
	return (self.text?.count ?? 0) > 0
    }

    public var isFilledBinding: Driver<Bool>
    {
	return self.rx.text.map { $0?.count ?? 0 > 0 }.asDriver(onErrorJustReturn: false)
    }
}


// then add the RequiredProperty instance into RxRequiredPropertyChecker
let textField: UITextField

let checker = RxRequiredPropertyChecker()
checker.add(textField)

// bind checker with other
checker.rx.isFilled.drive(self.button.rx.isEnable)
		   .disposed(by: self.disposeBag)

GitHub

link
Stars: 0
Last commit: 1 year ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Dependencies

Release Notes

1.1.1
1 year ago

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