Giter Club home page Giter Club logo

valueaddkeypath's Introduction

#Value Add Key Path

Value Add Key Path is a key path grammar taken to it's Cocoa Extreme. It allows creation of keypaths with custom collection operations and collection filtering with NSPredicate. It is a goal to allow the lookup of any object in your application with a single string.

Using this in Application code is probably a bad idea. Using this in Test Code, is very nice.

This was written to give Frank users a Cocoa option for looking up objects using frank. It allows the tester to work with non-UIView objects as well as use a grammar Cocoa developers are used to. It is very wordy, but clear and easily extensible. Think of it as an alternative to UISpec rather than an advanced keypath.

In addition to custom Key Paths, there is also a category to simplify object lookup and a SelectorEngine for use inside Frank.

##Basics

  • Objects can be filtered by adding a NSPredicate defined by a '[[.*]]' block
  • Only NSArray and NSSet object supported by default
  • Any object can add filtering support by implementing filteredValueAddUsingPredicate:
  • Execute a method on an object by preceding the key path with a @
  • Arguments are not currently supported. Grammar suggestions are desired!
  • Regular key path collection operations may not be supported without additional categories

##Examples

Assume the following wrapper for the examples below.

[[UIApplication sharedApplication] valueAddKeyPath:$EXAMPLE]

To obtain a list of all subviews:

To obtain a specific type of view:

[email protected][[class.description='UILabel']]

To obtain the view's grand parent:

[email protected][[class.description='UILabel']].superview.superview

To Ensure that the specified view is not moving

[email protected][[class.description='UILabel' AND tag=1000 AND isHidden=NO AND isOnScreen=YES]][email protected][[isAnimating = 0]]

Yes, it's a bit excessive, but it makes easy to bridge into scripting languages.

valueaddkeypath's People

Watchers

 avatar James Cloos avatar

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.