Code Monkey home page Code Monkey logo

proximityuuidformatter's Introduction

proximityUUIDFormatter

Unmaintained

Yet another Objective-C repo that will remain unmaintained indefinitely or until I can write a Swift version to replace it.

This may no longer be useful since Apple is apparently going to prevent direct UUID input in apps.. See this article and this follow-up article for more information.

Simple, light-weight convenience TextField formatter for dealing with Proximity UUID in a text field, to try and make it easier when having to type in that pain in the ass 32 char value....

Key Features

  • Automatically inserts hyphens at the appropriate spot while typing in a ProximityUUID
  • Allows user to Cut/Copy/Paste at any position without it affecting the automatic insertion of said hyphens
  • Restrics the ProximityUUID to be at the max 32 characters
  • Dead simple to use and unobtrusive

Video:

Video 1

Usage

Usage is really easy. The main things you need to do is just add a UITextField, set the delegate, and then use the proximityUUIDFormatter. Check out the example included with this source to see an example.

One small gotcha: The UITextField attribute Editing Changed has been wired up to the formatProximityUUIDInTextField method. You could obviously just do this manually as well - but I'm lazy and don't like writing code I don't have to.

This solution is inspired by this excellent stackoverflow solution by Mark Amery.

Available Public Methods

Here is a list of Available Public Methods available by the proximityUUIDFormatter...

Extras/Helpers Methods
  • +(NSString *)generateUUID - Quick way to generate a random UUID
  • +(NSUUID *)proximityUUIDFromUUID:(id)UUID - Convenience method to allow us to work with either a UUID String or Object
  • +(BOOL)isValidProximityUUID:(NSString *)proximityUUID - Is this a valid ProximityUUID?
Primary Usage Methods
  • +(void)storeValuesInTextField:(UITextField *)textField - Ensures we keep a properly structured, 32-character value.
  • +(void)formatTextField:(UITextField *)textField - Handles the actual heavy lifting of formatting/keeping track of cursor position, and all that other jazz...

Todo - One day?

  • Force allow only A-F alpha characters
  • Perhaps even create a Keyboard Layout that is specifically designed to make entering these values easier by only showing A-F and 0-9 keys? Hmm? Any takers? meh...

References/Resources

License Crap

See LICENSE included with this repo. Long story short - I'm a dev, you're a dev - we all make great stuff that works, but we also make shitty stuff that breaks...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.