Skip to content
This repository has been archived by the owner on Mar 24, 2022. It is now read-only.

Overview

Andrew Kitchen edited this page Apr 2, 2014 · 1 revision

PivotalCoreKit is split along framework lines, with separate Xcode projects for the Foundation, UIKit, and CoreLocation frameworks. Each project is then separated again out into sub-sections: Core, SpecHelper, and SpecHelperStubs.

Core methods are meant to be used anywhere they're useful, whether in specs or in the primary application.
SpecHelper extends built-in classes to make testing easier and more seamless.
SpecHelperStubs stub out (and replace) a class's functionality to allow a developer to more easily inspect its state.

Here is a (hopefully exhaustive but inevitably out of date) list of PivotalCoreKit functionality, separated by framework/section:

  • Foundation
    • Core
      • Convert NSString into a SHA1 hash (as NSData)
      • Convert NSData into a hexadecimal string
      • Method redirection on NSObjects (also commonly called Swizzling)
      • Convert an NSString ("Hello world I am doing great today") into camel case ("HelloWorldIAmDoingGreatToday")
      • Check if an NSString is blank
      • Check if an NSString is a valid email address
      • Percent escape encode an NSString including characters the build-in percent escaping doesn't include.
      • Map an NSArray into another NSArray by collecting items through a block
      • Convert an NSDictionary into a string of query parameters
      • NSURLConnectionDelegate based networking service (PCKHTTPConnection and PCKHTTPInterface)
      • An event-driven XML parser (PCKParser)
    • SpecHelper
      • Break out query parameters of an NSURL into an NSDictionary
      • Fake out NSURLConnection to keep it from actually accessing network and fire success/failure responses on demand
      • Return the body of an NSURLRequest as a string
      • Fake out +[NSUUID UUID] to return consistent results
      • Fake out NSOperationQueue to execute blocks on demand
  • UIKit
    • Core
      • Produce a UIBarButtonItem from a UIButton
      • Load nib-based views from other nibs with bindings and layout constraints intact
      • Resize a UIImage with aspect fill or aspect fit
      • Crop a UIImage or add rounded corners
      • Translating UIViews by deltas
      • Resizing UIViews with corner pinning
      • Calculate height from NSString and NSAttributedString drawing
    • SpecHelper
      • Simulate a tap on
        • UIButton
        • UITableViewCell
        • UICollectionViewCell
        • UIBarButtonItem
        • UITabBarController item
      • Simulate a tap, swipe, or pinch on a UIView (triggers attached gesture recognizers)
      • Simulate a new value for a UISlider
      • Simulate recognition of specific gesture recognizer
      • Compare UIImages for equality
      • Query a UIWindow for the first responder
    • SpecHelperStubs
      • Query, inspect, and simulate taps on the current UIActionSheet
      • Query, inspect, and simulate taps on the current UIAlertView
      • Query, inspect, present and dismiss a UIPopoverController
      • Simulate availability states of UIImagePickerController (camera available/not available, et cetera)
      • Inspect arguments (duration, delay, options) on last UIView animation
      • Fake out UIWebView to inspect requests, simulate back/forward state, and simulate web loads
  • CoreLocation
    • SpecHelper
      • Simulate Geocoding success or failure

PivotalCoreKit is test-driven and includes Specs in each project.

Clone this wiki locally