how to know when text is pasted into UITextView

Here is what i use to detect paste events in UITextView: // Set this class to be the delegate of the UITextView. Now when a user will paste a text in that textview, this delegate will be called. -(BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text { // Here we check if the replacement text is equal to … Read more

header search path in XCode 4

Click on the project in the file navigator on the left. Then click on the project or target in the editor that appears. Click on “Build Settings”, then change from “Basic” to “All”. Its under search paths.

Xcode: TEST vs DEBUG preprocessor macros

Preprocessor macros will not work, you need to check the environment at runtime. Objective-c static BOOL isRunningTests(void) { NSDictionary* environment = [[NSProcessInfo processInfo] environment]; return (environment[@”XCTestConfigurationFilePath”] != nil); } Swift var unitTesting : Bool { return ProcessInfo.processInfo.environment[“XCTestConfigurationFilePath”] != nil } (Updated for Xcode 11)

How can I use the legacy build system with Xcode 10’s `xcodebuild`?

There is an (as of yet undocumented) flag in xcodebuild: -UseModernBuildSystem=<value>. The value can be either 0 or NO to use the legacy (“original”) build system, or 1 or YES to use the new build system. For example: xcodebuild -workspace Foo.xcworkspace -scheme Bar -configuration Release -archivePath /path/to/Foo.xcarchive clean archive -UseModernBuildSystem=NO (-UseNewBuildSystem=<value> seems to work as … Read more