NxEnabled
  • October 21, 2023

What is NxEnabled?


It’s a fairly common case, when the enabled state of button depends on some textable elements such as TextView, TextField. So this library allows the simplest way to achive this purpose with only few lines of code.

Getting started


Typical login screen with short, beautiful validation code:

loginButton.isEnabled(by: usernameTextField, passwordTextField) { username, password in
username.characters.count > 5 && password.characters.count > 5
}

you can also combine together UITextView with UITextField‘s:

signUpButton.isEnabled(by: firstnameTextField, lastnameTextField, bioTextView) { firstname, lastname, bio in
return /* validation value */
}

So there is also oportunity to add not UI element:

  • Implement Textable protocol

  • Be a successor from NSObject

  • Not forget about dynamic label for property

  • Done.

class Object: NSObject, Textable {
dynamic var value: String?
var textKey: String {
return “value”
}
}

NOTE:

One important case is that you should clear button’s bag. It removes all observers from textable elements. Usually it needs to do in deinit method.

 

deinit {
signUpButton.clearBag()
}

Now library allows to add textable elements up to six.

Installation


CocoaPods

To integrate NxEnabled into your Xcode project using Carthage, specify it in your Cartfile:

github “Otbivnoe/NxEnabled”

Run carthage update to build the framework and drag the built NxEnabled.framework into your Xcode project.

GitHub


View Github

#algolia #animation #awesemetextfield #carthage #cocoapods #currencytextfield #customtextfield #customwidgets #facetedsearch #geosearch #growingtextview #instantsearch #interfacebuilder #ios #ioslibrary #opensource #passwordtextfield #search #searchengine #searchinterface #searchsynonyms #styledtext #swift #swiftpackagemanager #textexpansion #textfield #texture #textview #tjtextfield #ui #uibutton #uikit #uitextfield #uitextfieldnavigation #uitextview #widgets
YOU MIGHT ALSO LIKE...
exyte

     

camerakit-ios

CameraKit helps you add reliable camera to your app quickly. Our open source camera platform provides consistent capture results, service ...

HybridCamera

[video width="192" height="416" mp4="https://swiftgit.com/wp-content/uploads/2024/12/68747470733a2f2f7261776769742e636f6d2f7374796c656b69742f696d672f6d61737465722f7669645f6564697465645f325f326d622e676966.mp4"][/video]

TakeASelfie

An iOS framework that uses the front camera, detects your face and takes a selfie. This api opens the front ...

iOS-Depth-Sampler

Code examples of Depth APIs in iOS