Code Monkey home page Code Monkey logo

numericcontrolfield's People

Contributors

celanajaya avatar massimobio avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

numericcontrolfield's Issues

Component Features

I have a few questions about how to handle some aspects of functionality:

  1. Our component is designed to handle numeric values. Should we be enforcing numeric values when someone edits the textfield manually?

  2. The textField becomes editable when a user double clicks. Should we allow developers to turn off this feature making it only editable via click/drag?

  3. If the textField is editable, should we also be calling the custom delegate/closure in textDidEndEditing? or some similar method so the ViewController data remains consistent with the textField's contents?

  4. Should we write/expose any custom methods for editing the cursor's appearance?

Protocol vs Delegate

In response to @celanajaya 's question in the comments on the AdjustableTextField, I like the idea of having both options.
Maybe we should have two controls in the demo app, one using delegation and one using the closure.

As far as naming I was thinking that onValueChanged sounds a little Androidy to me.

What do you think about valueChangedHandler and didChangeValue for the Delegate Protocol?
If there was use for it we could even add more delegate methods such as didStartDragging and didFinishDragging in case we wanted to updated to UI or wait for the final value to be ready before acting on it... possibilities

Swift formatting

Not sure if you use some formatting tool but I have been using this:
https://github.com/nicklockwood/SwiftFormat

It's really nice. It has a Xcode plugin that I mapped to a key combo for ease of use.

It formats everything from removing empty multiple lines to correctly formatting space around parameter in functions. Highly recommended ๐Ÿ‘

I would also help reducing noice in the diffs when doing pull requests because it would enforce us to use the same formatting.

Project/Component name and description

Not critical but we should brainstorm a better name for the project/component, which will be important for discoverability if we add support for Cocoapods and when we make a nice README about it.

The current name has some issues:

  • AdjustableTextField puts a lot of importance on the TextField aspect which implies any kind of text can be inserted while it's really for numeric values only
  • The 'adjustable' adjective in this combination seems to indicate that you can adjust the textfield somehow... size? color?... unclear.

If I try to describe the component in words, it's a numeric control that allows both typing-in numeric values as well as click-n-draging to adjust the value.
Garageband has a nice implementation of this kind of control:
screen shot 2017-07-26 at 10 46 48 am

The tempo value looks like a label but when you hover over it, the background highlights so it feels clickable. When you click on it, the cursor turns into a short dash which helps with discoverability of the drag-to-adjust feature. If you double click it turns into an editable textfield with the numbers selected so that you can immediately start typing.

Name brainstorming:

  • it's a numeric control/label/button
  • it's a type-your-value in a textfield control
  • it's a (hidden) slider kind of control
  • don't think SwiftySomething is good because it's not a port of an obj-c project and there are too many Swifty projects already
    ...
    NumericMultiControl
    AdvancedNumericControl
    Value something could also be good
    Number instead of Numeric....
    ...
    ...

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.