Skip to content

Commit

Permalink
Upgraded project settings for Xcode 4.6 and corrected several errors …
Browse files Browse the repository at this point in the history
…relating to memory management under ARC. Special thanks to @JanX2 for these contributions.
  • Loading branch information
warrenm committed Feb 27, 2013
1 parent 27b77ce commit a9eab1e
Show file tree
Hide file tree
Showing 12 changed files with 59 additions and 64 deletions.
38 changes: 19 additions & 19 deletions AHEasing.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
804527B916A63528001DB532 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 804527B816A63528001DB532 /* QuartzCore.framework */; };
804527BC16A63724001DB532 /* PlaygroundView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 804527BA16A63724001DB532 /* PlaygroundView.xib */; };
804527BF16A63736001DB532 /* PlaygroundView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 804527BD16A63736001DB532 /* PlaygroundView.xib */; };
804527C216A668BF001DB532 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 804527C116A668BF001DB532 /* CoreGraphics.framework */; };
804527C616A668D6001DB532 /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 804527C516A668D6001DB532 /* AppKit.framework */; };
804527CA16A66A6F001DB532 /* Icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 804527C816A66A6F001DB532 /* Icon.png */; };
804527CB16A66A6F001DB532 /* Icon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 804527C916A66A6F001DB532 /* Icon@2x.png */; };
Expand Down Expand Up @@ -101,7 +100,6 @@
buildActionMask = 2147483647;
files = (
804527C616A668D6001DB532 /* AppKit.framework in Frameworks */,
804527C216A668BF001DB532 /* CoreGraphics.framework in Frameworks */,
804527B716A6351A001DB532 /* QuartzCore.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -264,7 +262,7 @@
806EB7E2138F91A700E2D4A7 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0430;
LastUpgradeCheck = 0460;
ORGANIZATIONNAME = "Auerhaus Development, LLC";
};
buildConfigurationList = 806EB7E5138F91A700E2D4A7 /* Build configuration list for PBXProject "AHEasing" */;
Expand Down Expand Up @@ -415,6 +413,7 @@
"DEBUG=1",
"$(inherited)",
);
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_UNINITIALIZED_AUTOS = NO;
INFOPLIST_FILE = "EasingPlayground-iOS/EasingPlayground-iOS-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 4.3;
Expand All @@ -440,6 +439,7 @@
COPY_PHASE_STRIP = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "EasingPlayground-iOS/EasingPlayground-iOS-Prefix.pch";
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_UNINITIALIZED_AUTOS = NO;
INFOPLIST_FILE = "EasingPlayground-iOS/EasingPlayground-iOS-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 4.3;
Expand All @@ -455,8 +455,8 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_CXX_LANGUAGE_STANDARD = "compiler-default";
CLANG_CXX_LIBRARY = "compiler-default";
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_EMPTY_BODY = YES;
Expand All @@ -466,10 +466,8 @@
CODE_SIGN_IDENTITY = "Mac Developer";
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"\"$(SYSTEM_APPS_DIR)/Xcode46-DP4.app/Contents/Developer/Library/Frameworks\"",
);
FRAMEWORK_SEARCH_PATHS = "$(DEVELOPER_FRAMEWORKS_DIR)";
GCC_C_LANGUAGE_STANDARD = "compiler-default";
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
Expand All @@ -478,10 +476,11 @@
AH_EASING_USE_DBL_PRECIS,
"DEBUG=1",
);
GCC_VERSION = "";
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_UNINITIALIZED_AUTOS = NO;
INFOPLIST_FILE = "EasingPlayground-Mac/EasingPlayground-Mac-Info.plist";
MACOSX_DEPLOYMENT_TARGET = 10.8;
MACOSX_DEPLOYMENT_TARGET = 10.7;
ONLY_ACTIVE_ARCH = YES;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
Expand All @@ -495,8 +494,8 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_CXX_LANGUAGE_STANDARD = "compiler-default";
CLANG_CXX_LIBRARY = "compiler-default";
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_EMPTY_BODY = YES;
Expand All @@ -507,18 +506,17 @@
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"\"$(SYSTEM_APPS_DIR)/Xcode46-DP4.app/Contents/Developer/Library/Frameworks\"",
);
FRAMEWORK_SEARCH_PATHS = "$(DEVELOPER_FRAMEWORKS_DIR)";
GCC_C_LANGUAGE_STANDARD = "compiler-default";
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "EasingPlayground-Mac/EasingPlayground-Mac-Prefix.pch";
GCC_PREPROCESSOR_DEFINITIONS = AH_EASING_USE_DBL_PRECIS;
GCC_VERSION = "";
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_UNINITIALIZED_AUTOS = NO;
INFOPLIST_FILE = "EasingPlayground-Mac/EasingPlayground-Mac-Info.plist";
MACOSX_DEPLOYMENT_TARGET = 10.8;
MACOSX_DEPLOYMENT_TARGET = 10.7;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
SDKROOT = macosx;
Expand All @@ -539,7 +537,7 @@
GCC_VERSION = com.apple.compilers.llvmgcc42;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 3.2;
IPHONEOS_DEPLOYMENT_TARGET = 4.3;
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
PROVISIONING_PROFILE = "";
SDKROOT = iphoneos;
Expand All @@ -556,7 +554,7 @@
GCC_VERSION = com.apple.compilers.llvmgcc42;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 3.2;
IPHONEOS_DEPLOYMENT_TARGET = 4.3;
OTHER_CFLAGS = "";
PROVISIONING_PROFILE = "";
SDKROOT = iphoneos;
Expand All @@ -573,6 +571,7 @@
8045278D16A63162001DB532 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
804527A716A6318C001DB532 /* Build configuration list for PBXNativeTarget "EasingPlayground-Mac" */ = {
isa = XCConfigurationList;
Expand All @@ -581,6 +580,7 @@
804527A916A6318C001DB532 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
806EB7E5138F91A700E2D4A7 /* Build configuration list for PBXProject "AHEasing" */ = {
isa = XCConfigurationList;
Expand Down
4 changes: 2 additions & 2 deletions EasingPlayground-Common/EasingFunctionGraphView.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
#if TARGET_OS_IPHONE

@interface EasingFunctionGraphView : UIView
@property(nonatomic, assign) IBOutlet UIViewController *viewController; // Unused. Only here to void further preprocessor directives in the .m file.
@property(nonatomic, strong) IBOutlet UIViewController *viewController; // Unused. Only here to void further preprocessor directives in the .m file.

#else

@interface EasingFunctionGraphView : NSView
@property(nonatomic, assign) IBOutlet NSViewController *viewController;
@property(nonatomic, strong) IBOutlet NSViewController *viewController;

#endif

Expand Down
35 changes: 19 additions & 16 deletions EasingPlayground-Common/EasingFunctionGraphView.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ - (void)commonInitialization;

@implementation EasingFunctionGraphView

@synthesize gridBounds, easingFunction, viewController;

- (id)initWithFrame:(CGRect)frame
{
if((self = [super initWithFrame:frame]))
Expand All @@ -41,35 +39,35 @@ - (id)initWithCoder:(NSCoder *)aDecoder

- (void)commonInitialization
{
easingFunction = LinearInterpolation;
gridBounds = CGRectMake(-1.3, -0.4, 3.6, 1.8);
_easingFunction = LinearInterpolation;
_gridBounds = CGRectMake(-1.3, -0.4, 3.6, 1.8);
}

#if !TARGET_OS_IPHONE
- (void)setViewController:(NSViewController *)newController
{
if (viewController)
if(_viewController)
{
NSResponder *controllerNextResponder = [viewController nextResponder];
NSResponder *controllerNextResponder = [_viewController nextResponder];
[super setNextResponder:controllerNextResponder];
[viewController setNextResponder:nil];
[_viewController setNextResponder:nil];
}

viewController = newController;
_viewController = newController;

if (newController)
{
NSResponder *ownNextResponder = [self nextResponder];
[super setNextResponder: viewController];
[viewController setNextResponder:ownNextResponder];
[super setNextResponder:_viewController];
[_viewController setNextResponder:ownNextResponder];
}
}

- (void)setNextResponder:(NSResponder *)newNextResponder
{
if (viewController)
if(_viewController)
{
[viewController setNextResponder:newNextResponder];
[_viewController setNextResponder:newNextResponder];
return;
}

Expand All @@ -96,12 +94,12 @@ - (void)drawRect:(CGRect)rect
#endif

CGSize viewSize = [self bounds].size;
CGSize gridSize = gridBounds.size;
CGSize gridSize = self.gridBounds.size;

CGFloat xScale = viewSize.width / gridSize.width;
CGFloat yScale = viewSize.height / gridSize.height;

CGPoint mappedOrigin = gridBounds.origin;
CGPoint mappedOrigin = self.gridBounds.origin;

// Transform view coordinates to match grid coordinates
CGContextScaleCTM(context, xScale, -yScale);
Expand Down Expand Up @@ -136,12 +134,12 @@ - (void)drawRect:(CGRect)rect

// Draw easing function path
CGFloat x = 0;
CGFloat y = easingFunction(x);
CGFloat y = self.easingFunction(x);
CGContextMoveToPoint(context, x, y);

while(x <= 1.0)
{
CGFloat y = easingFunction(x);
CGFloat y = self.easingFunction(x);
CGContextAddLineToPoint(context, x, y);
x += gridSize.width / 300;
}
Expand All @@ -150,6 +148,11 @@ - (void)drawRect:(CGRect)rect
CGContextSetLineJoin(context, kCGLineJoinRound);
CGContextSetStrokeColorWithColor(context, black);
CGContextStrokePath(context);

#if !TARGET_OS_IPHONE
CGColorRelease(lightGray);
CGColorRelease(black);
#endif
}

@end
3 changes: 2 additions & 1 deletion EasingPlayground-Mac/AppDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

@interface AppDelegate : NSObject <NSApplicationDelegate>

@property (assign) IBOutlet NSWindow *window;
@property (strong) IBOutlet NSWindow *window;
@property (strong) IBOutlet NSViewController *viewController;

@end
6 changes: 2 additions & 4 deletions EasingPlayground-Mac/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@

@implementation AppDelegate

@synthesize window;

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
PlaygroundNSViewController *vc = [[PlaygroundNSViewController alloc] initWithNibName:@"PlaygroundView" bundle:nil];
[self.window.contentView addSubview:vc.view];
self.viewController = [[PlaygroundNSViewController alloc] initWithNibName:@"PlaygroundView" bundle:nil];
[self.window.contentView addSubview:self.viewController.view];

}

Expand Down
4 changes: 2 additions & 2 deletions EasingPlayground-Mac/PlaygroundNSViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
AHEasingFunction currentFunction;
}

@property(nonatomic, retain) IBOutlet NSView *boid;
@property(nonatomic, retain) IBOutlet EasingFunctionGraphView *graphView;
@property(nonatomic, strong) IBOutlet NSView *boid;
@property(nonatomic, strong) IBOutlet EasingFunctionGraphView *graphView;

- (IBAction)curveSelectionChanged:(id)sender;
- (IBAction)easingSelectionChanged:(id)sender;
Expand Down
8 changes: 3 additions & 5 deletions EasingPlayground-Mac/PlaygroundNSViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

@implementation PlaygroundNSViewController

@synthesize boid, graphView;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
if((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]))
Expand Down Expand Up @@ -60,7 +58,7 @@ - (void)mouseUp:(NSEvent *)theEvent

animating = YES;

[graphView setNeedsDisplay:YES];
[self.graphView setNeedsDisplay:YES];
}
}

Expand Down Expand Up @@ -108,8 +106,8 @@ - (void)configureEasingFunction
break;
}

[graphView setEasingFunction:currentFunction];
[graphView setNeedsDisplay:YES];
[self.graphView setEasingFunction:currentFunction];
[self.graphView setNeedsDisplay:YES];
}

- (IBAction)curveSelectionChanged:(id)sender
Expand Down
2 changes: 1 addition & 1 deletion EasingPlayground-iOS/AppDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@

@interface AppDelegate : UIResponder <UIApplicationDelegate>

@property (nonatomic, retain) UIWindow *window;
@property (nonatomic, strong) UIWindow *window;

@end
2 changes: 0 additions & 2 deletions EasingPlayground-iOS/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

@implementation AppDelegate

@synthesize window;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
Expand Down
8 changes: 4 additions & 4 deletions EasingPlayground-iOS/PlaygroundViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
AHEasingFunction currentFunction;
}

@property(nonatomic, retain) IBOutlet UIView *boid;
@property(nonatomic, retain) IBOutlet EasingFunctionGraphView *graphView;
@property (nonatomic, retain) IBOutlet UISegmentedControl *curveSegmentedControl;
@property (nonatomic, retain) IBOutlet UISegmentedControl *easingSegmentedControl;
@property(nonatomic, strong) IBOutlet UIView *boid;
@property(nonatomic, strong) IBOutlet EasingFunctionGraphView *graphView;
@property (nonatomic, strong) IBOutlet UISegmentedControl *curveSegmentedControl;
@property (nonatomic, strong) IBOutlet UISegmentedControl *easingSegmentedControl;

- (IBAction)curveSelectionChanged:(id)sender;
- (IBAction)easingSelectionChanged:(id)sender;
Expand Down
6 changes: 2 additions & 4 deletions EasingPlayground-iOS/PlaygroundViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

@implementation PlaygroundViewController

@synthesize boid, graphView, curveSegmentedControl, easingSegmentedControl;

#pragma mark - View lifecycle

- (void)viewDidLoad
Expand Down Expand Up @@ -106,8 +104,8 @@ - (void)configureEasingFunction
break;
}

[graphView setEasingFunction:currentFunction];
[graphView setNeedsDisplay];
[self.graphView setEasingFunction:currentFunction];
[self.graphView setNeedsDisplay];
}

- (IBAction)curveSelectionChanged:(id)sender
Expand Down
7 changes: 3 additions & 4 deletions EasingPlayground-iOS/main.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@

int main(int argc, char *argv[])
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
int value = UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
[pool drain];
return value;
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}

0 comments on commit a9eab1e

Please sign in to comment.