Xcode – exclude files in a custom configuration – better way?
I’m trying to come up with a way to make it easy to switch out our “mock” data services and our live ones. Basically, we’ll have live servers with real web services, but for whatever reason, a developer may want to load data from static files (file urls).
I figured I would solve this problem by creating categories that override the methods that fetch the data, thus leaving original code untouched (it has no concept of the “mock” data). I don’t want to litter my code with
I can put an #ifdef at the very beginning of each file that has categories in it, and I can set a custom flag in the configuration settings, but I’d rather just have a way to include or exclude the files depending on the configuration. Is that possible? How do you solve this problem?
- Zooming a UIScrollView in MonoTouch
- UIWebView Movie Player getting dismissed iOS 6 bug
- UISystemGateGestureRecognizer and delayed taps near bottom of screen
- How to convert NSData to byte array in iPhone?
- push viewcontroller using UINavigationController sometimes calls viewDidAppear: and viewWillAppear:
- How to draw a triangle programmatically
3 Solutions Collect From Internet About “Xcode – exclude files in a custom configuration – better way?”
The trick is to define EXCLUDED_SOURCE_FILE_NAMES in the configuration you want to exclude the files from, and set the value of that custom build setting to a list of the file names (or a pattern that matches those, and only those, file names).
I would recommend creating two targets one of which has the mock categories included and another one which does not.
When you want to test, just build the target containing the mock categories. Everything else can remain identical.
If you would like to add a file but do not wont to compile it. Go to (for all your targets) project>build phases>compile source and take out the file that you do not want to compile.
- More efficient way to retrieve Firebase Data?
- xcode error : Cannot call value of non-function type module Firebase
- content blocker works in simulator but does not work in iPhone device
- How to start with empty Core Data for every UI Test Assertion in Swift?
- Can I build my own networking framework (which is dependent on AFNetworking) as a watchOS2 framework?
- How to generate random image using image view in swift
- iOS App crash with SIGTRAP in iPhone 6 plus?
- Autolayout: why are these same constrains different?
- CGAffineTransformInvert: singular matrix
- How to take a picture and save in SQLite database on iOS
- Sorting NSMutablearray by NSString as a date
- Invalid Binary File after uploading on ITunesConnect
- Swift: How to implement a login storyboard?
- Different iPhone devices with single storyboard by using Xcode 8
- iOS – Flip animation only for specific view