Skip to content

Commit

Permalink
Users no longer need to put -all_load in build settings.
Browse files Browse the repository at this point in the history
  • Loading branch information
kstenerud committed Jul 16, 2011
1 parent ac42feb commit 8d9cdd9
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 2 deletions.
34 changes: 34 additions & 0 deletions Additions/LoadableCategory.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//
// LoadableCategory.h
// Objective-Gems
//
// Copyright 2011 Karl Stenerud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Note: You are NOT required to make the license available from within your
// iOS application. Including it in your project is sufficient.
//
// Attribution is not required, but appreciated :)
//


/** Make all categories in the current file loadable without using -load-all.
*
* Normally, compilers will skip linking files that contain only categories.
* Adding a call to this macro adds a dummy class, which causes the linker
* to add the file.
*
* @param UNIQUE_NAME A globally unique name.
*/
#define MAKE_CATEGORIES_LOADABLE(UNIQUE_NAME) @interface FORCELOAD_##UNIQUE_NAME @end @implementation FORCELOAD_##UNIQUE_NAME @end
4 changes: 4 additions & 0 deletions Additions/NSFileManager-KIFAdditions.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
//

#import "NSFileManager-KIFAdditions.h"
#import "LoadableCategory.h"


MAKE_CATEGORIES_LOADABLE(NSFileManager_KIFAdditions)


@implementation NSFileManager (CCAdditions)
Expand Down
4 changes: 4 additions & 0 deletions Additions/UIAccessibilityElement-KIFAdditions.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
//

#import "UIAccessibilityElement-KIFAdditions.h"
#import "LoadableCategory.h"


MAKE_CATEGORIES_LOADABLE(UIAccessibilityElement_KIFAdditions)


@implementation UIAccessibilityElement (KIFAdditions)
Expand Down
4 changes: 4 additions & 0 deletions Additions/UIApplication-KIFAdditions.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@
//

#import "UIApplication-KIFAdditions.h"
#import "LoadableCategory.h"
#import "UIView-KIFAdditions.h"


MAKE_CATEGORIES_LOADABLE(UIApplication_KIFAdditions)


@implementation UIApplication (KIFAdditions)

- (UIAccessibilityElement *)accessibilityElementWithLabel:(NSString *)label;
Expand Down
4 changes: 4 additions & 0 deletions Additions/UIScrollView-KIFAdditions.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@
//

#import "UIScrollView-KIFAdditions.h"
#import "LoadableCategory.h"
#import "UIApplication-KIFAdditions.h"
#import "UIView-KIFAdditions.h"


MAKE_CATEGORIES_LOADABLE(UIScrollView_KIFAdditions)


@implementation UIScrollView (KIFAdditions)

- (void)scrollViewToVisible:(UIView *)view animated:(BOOL)animated;
Expand Down
4 changes: 4 additions & 0 deletions Additions/UITouch-KIFAdditions.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
//

#import "UITouch-KIFAdditions.h"
#import "LoadableCategory.h"


MAKE_CATEGORIES_LOADABLE(UITouch_KIFAdditions)


@implementation UITouch (KIFAdditions)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,6 @@
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
"-all_load",
);
PRODUCT_NAME = "Testable (Integration Tests)";
WRAPPER_EXTENSION = app;
Expand Down Expand Up @@ -400,7 +399,6 @@
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
"-all_load",
);
PRODUCT_NAME = "Testable (Integration Tests)";
VALIDATE_PRODUCT = YES;
Expand Down
4 changes: 4 additions & 0 deletions KIF.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
39160B1113D1E6BB00311E38 /* LoadableCategory.h in Headers */ = {isa = PBXBuildFile; fileRef = 39160B1013D1E6BB00311E38 /* LoadableCategory.h */; };
AAB0726C139719AC008AF393 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AAB0726B139719AC008AF393 /* Foundation.framework */; };
AAB0728213971A63008AF393 /* KIF-Prefix.pch in Headers */ = {isa = PBXBuildFile; fileRef = AAB0728113971A63008AF393 /* KIF-Prefix.pch */; };
AAB0728D13971A98008AF393 /* KIFTestController.h in Headers */ = {isa = PBXBuildFile; fileRef = AAB0728613971A98008AF393 /* KIFTestController.h */; };
Expand Down Expand Up @@ -35,6 +36,7 @@
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
39160B1013D1E6BB00311E38 /* LoadableCategory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LoadableCategory.h; sourceTree = "<group>"; };
AAB07268139719AC008AF393 /* libKIF.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libKIF.a; sourceTree = BUILT_PRODUCTS_DIR; };
AAB0726B139719AC008AF393 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
AAB0728113971A63008AF393 /* KIF-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "KIF-Prefix.pch"; path = "Classes/KIF-Prefix.pch"; sourceTree = SOURCE_ROOT; };
Expand Down Expand Up @@ -131,6 +133,7 @@
AAB0729313971AB2008AF393 /* Additions */ = {
isa = PBXGroup;
children = (
39160B1013D1E6BB00311E38 /* LoadableCategory.h */,
AAB0729413971AB2008AF393 /* CGGeometry-KIFAdditions.h */,
AAB0729513971AB2008AF393 /* CGGeometry-KIFAdditions.m */,
CDFD8E84139728B4008D299F /* NSFileManager-KIFAdditions.h */,
Expand Down Expand Up @@ -170,6 +173,7 @@
AAB072B013971AB2008AF393 /* UIView-KIFAdditions.h in Headers */,
AAB072B213971AB2008AF393 /* UIWindow-KIFAdditions.h in Headers */,
CDFD8E86139728B4008D299F /* NSFileManager-KIFAdditions.h in Headers */,
39160B1113D1E6BB00311E38 /* LoadableCategory.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down

0 comments on commit 8d9cdd9

Please sign in to comment.