Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Some conventions updates in VELCAAction's interface (and class extens…

…ion) documentation, and renamed the geometry change method

Reviewed by James Lawton.
  • Loading branch information...
commit fb6eb6e9e92fde463cd982607bdc25134dc9f002 1 parent f70a735
Justin Spahr-Summers jspahrsummers authored
12 Framework/Velvet/Velvet/VELCAAction.h
@@ -10,26 +10,28 @@
10 10 #import <QuartzCore/QuartzCore.h>
11 11
12 12 /**
13   - * A CAAction which finds NSViews contained in Velvet and animated them alongside.
14   - * We pass through to the default animation to animate the Velvet views.
  13 + * A `CAAction` which finds AppKit views contained in Velvet and animates them
  14 + * alongside. We pass through to the default animation to animate the Velvet
  15 + * views.
15 16 */
16 17 @interface VELCAAction : NSObject <CAAction>
17 18
18 19 /**
19 20 * Initializes an action which proxies for the given action, and handles animation
20   - * of descendent VELNSViews to the VELView whose layer it acts on.
  21 + * of all descendent `VELNSView` instances along with the layer being acted upon.
21 22 *
22 23 * This is the designated initializer.
23 24 */
24 25 - (id)initWithAction:(id <CAAction>)innerAction;
25 26
26 27 /**
27   - * Returns a caller-owned action, initialized with `initWithAction:`.
  28 + * Returns an action initialized with `initWithAction:`.
28 29 */
29 30 + (id)actionWithAction:(id <CAAction>)innerAction;
30 31
31 32 /**
32   - * Returns YES if objects of this class add features to actions for the given key.
  33 + * Returns `YES` if objects of this class add features to actions for the given
  34 + * key.
33 35 */
34 36 + (BOOL)interceptsActionForKey:(NSString *)key;
35 37
23 Framework/Velvet/Velvet/VELCAAction.m
@@ -13,8 +13,21 @@
13 13
14 14
15 15 @interface VELCAAction ()
  16 +/**
  17 + * The action that this action is proxying, as specified at the time of
  18 + * initialization.
  19 + */
16 20 @property (nonatomic, strong) id <CAAction> innerAction;
17   -- (void)handleGeometryChangeForKey:(NSString *)key layer:(CALayer *)layer;
  21 +
  22 +/**
  23 + * Invoked whenever the geometry property `key` of `layer` has changed.
  24 + */
  25 +- (void)geometryChangedForKey:(NSString *)key layer:(CALayer *)layer;
  26 +
  27 +/**
  28 + * Returns `YES` if objects of this class add features to actions for the given
  29 + * geometry property.
  30 + */
18 31 + (BOOL)interceptsGeometryActionForKey:(NSString *)key;
19 32 @end
20 33
@@ -27,6 +40,7 @@ - (id)initWithAction:(id <CAAction>)innerAction {
27 40 if (self) {
28 41 self.innerAction = innerAction;
29 42 }
  43 +
30 44 return self;
31 45 }
32 46
@@ -51,11 +65,11 @@ - (void)runActionForKey:(NSString *)key object:(id)anObject arguments:(NSDiction
51 65 return;
52 66
53 67 if ([[self class] interceptsGeometryActionForKey:key]) {
54   - [self handleGeometryChangeForKey:key layer:anObject];
  68 + [self geometryChangedForKey:key layer:anObject];
55 69 }
56 70 }
57 71
58   -- (void)handleGeometryChangeForKey:(NSString *)key layer:(CALayer *)layer {
  72 +- (void)geometryChangedForKey:(NSString *)key layer:(CALayer *)layer {
59 73 // For all contained VELNSViews, render their NSView into their layer
60 74 // and hide the NSView. Now the visual element is part of the layer
61 75 // hierarchy we're animating.
@@ -84,8 +98,7 @@ - (void)handleGeometryChangeForKey:(NSString *)key layer:(CALayer *)layer {
84 98 }
85 99
86 100 + (BOOL)interceptsGeometryActionForKey:(NSString *)key {
87   - return [key isEqualToString:@"position"]
88   - || [key isEqualToString:@"bounds"];
  101 + return [key isEqualToString:@"position"] || [key isEqualToString:@"bounds"];
89 102 }
90 103
91 104 + (BOOL)interceptsActionForKey:(NSString *)key {

0 comments on commit fb6eb6e

Please sign in to comment.
Something went wrong with that request. Please try again.