├── .gitignore ├── .travis.yml ├── Example ├── Podfile ├── Podfile.lock ├── Pods │ ├── Local Podspecs │ │ └── VeeContactPicker.podspec.json │ ├── Manifest.lock │ ├── OCMock │ │ ├── License.txt │ │ ├── README.md │ │ └── Source │ │ │ └── OCMock │ │ │ ├── NSInvocation+OCMAdditions.h │ │ │ ├── NSInvocation+OCMAdditions.m │ │ │ ├── NSMethodSignature+OCMAdditions.h │ │ │ ├── NSMethodSignature+OCMAdditions.m │ │ │ ├── NSNotificationCenter+OCMAdditions.h │ │ │ ├── NSNotificationCenter+OCMAdditions.m │ │ │ ├── NSObject+OCMAdditions.h │ │ │ ├── NSObject+OCMAdditions.m │ │ │ ├── NSValue+OCMAdditions.h │ │ │ ├── NSValue+OCMAdditions.m │ │ │ ├── OCClassMockObject.h │ │ │ ├── OCClassMockObject.m │ │ │ ├── OCMArg.h │ │ │ ├── OCMArg.m │ │ │ ├── OCMArgAction.h │ │ │ ├── OCMArgAction.m │ │ │ ├── OCMBlockArgCaller.h │ │ │ ├── OCMBlockArgCaller.m │ │ │ ├── OCMBlockCaller.h │ │ │ ├── OCMBlockCaller.m │ │ │ ├── OCMBoxedReturnValueProvider.h │ │ │ ├── OCMBoxedReturnValueProvider.m │ │ │ ├── OCMConstraint.h │ │ │ ├── OCMConstraint.m │ │ │ ├── OCMExceptionReturnValueProvider.h │ │ │ ├── OCMExceptionReturnValueProvider.m │ │ │ ├── OCMExpectationRecorder.h │ │ │ ├── OCMExpectationRecorder.m │ │ │ ├── OCMFunctions.h │ │ │ ├── OCMFunctions.m │ │ │ ├── OCMFunctionsPrivate.h │ │ │ ├── OCMIndirectReturnValueProvider.h │ │ │ ├── OCMIndirectReturnValueProvider.m │ │ │ ├── OCMInvocationExpectation.h │ │ │ ├── OCMInvocationExpectation.m │ │ │ ├── OCMInvocationMatcher.h │ │ │ ├── OCMInvocationMatcher.m │ │ │ ├── OCMInvocationStub.h │ │ │ ├── OCMInvocationStub.m │ │ │ ├── OCMLocation.h │ │ │ ├── OCMLocation.m │ │ │ ├── OCMMacroState.h │ │ │ ├── OCMMacroState.m │ │ │ ├── OCMNotificationPoster.h │ │ │ ├── OCMNotificationPoster.m │ │ │ ├── OCMObserverRecorder.h │ │ │ ├── OCMObserverRecorder.m │ │ │ ├── OCMPassByRefSetter.h │ │ │ ├── OCMPassByRefSetter.m │ │ │ ├── OCMRealObjectForwarder.h │ │ │ ├── OCMRealObjectForwarder.m │ │ │ ├── OCMRecorder.h │ │ │ ├── OCMRecorder.m │ │ │ ├── OCMReturnValueProvider.h │ │ │ ├── OCMReturnValueProvider.m │ │ │ ├── OCMStubRecorder.h │ │ │ ├── OCMStubRecorder.m │ │ │ ├── OCMVerifier.h │ │ │ ├── OCMVerifier.m │ │ │ ├── OCMock.h │ │ │ ├── OCMockObject.h │ │ │ ├── OCMockObject.m │ │ │ ├── OCObserverMockObject.h │ │ │ ├── OCObserverMockObject.m │ │ │ ├── OCPartialMockObject.h │ │ │ ├── OCPartialMockObject.m │ │ │ ├── OCProtocolMockObject.h │ │ │ └── OCProtocolMockObject.m │ ├── Pods.xcodeproj │ │ ├── project.pbxproj │ │ └── project.xcworkspace │ │ │ └── contents.xcworkspacedata │ ├── Target Support Files │ │ ├── OCMock │ │ │ ├── Info.plist │ │ │ ├── OCMock-dummy.m │ │ │ ├── OCMock-prefix.pch │ │ │ ├── OCMock-umbrella.h │ │ │ ├── OCMock.modulemap │ │ │ └── OCMock.xcconfig │ │ ├── Pods-VeeContactPicker_Example │ │ │ ├── Info.plist │ │ │ ├── Pods-VeeContactPicker_Example-acknowledgements.markdown │ │ │ ├── Pods-VeeContactPicker_Example-acknowledgements.plist │ │ │ ├── Pods-VeeContactPicker_Example-dummy.m │ │ │ ├── Pods-VeeContactPicker_Example-frameworks.sh │ │ │ ├── Pods-VeeContactPicker_Example-resources.sh │ │ │ ├── Pods-VeeContactPicker_Example-umbrella.h │ │ │ ├── Pods-VeeContactPicker_Example.debug.xcconfig │ │ │ ├── Pods-VeeContactPicker_Example.modulemap │ │ │ └── Pods-VeeContactPicker_Example.release.xcconfig │ │ ├── Pods-VeeContactPicker_Tests │ │ │ ├── Info.plist │ │ │ ├── Pods-VeeContactPicker_Tests-acknowledgements.markdown │ │ │ ├── Pods-VeeContactPicker_Tests-acknowledgements.plist │ │ │ ├── Pods-VeeContactPicker_Tests-dummy.m │ │ │ ├── Pods-VeeContactPicker_Tests-frameworks.sh │ │ │ ├── Pods-VeeContactPicker_Tests-resources.sh │ │ │ ├── Pods-VeeContactPicker_Tests-umbrella.h │ │ │ ├── Pods-VeeContactPicker_Tests.debug.xcconfig │ │ │ ├── Pods-VeeContactPicker_Tests.modulemap │ │ │ └── Pods-VeeContactPicker_Tests.release.xcconfig │ │ ├── UIImageView-AGCInitials │ │ │ ├── Info.plist │ │ │ ├── UIImageView-AGCInitials-dummy.m │ │ │ ├── UIImageView-AGCInitials-prefix.pch │ │ │ ├── UIImageView-AGCInitials-umbrella.h │ │ │ ├── UIImageView-AGCInitials.modulemap │ │ │ └── UIImageView-AGCInitials.xcconfig │ │ └── VeeContactPicker │ │ │ ├── Info.plist │ │ │ ├── ResourceBundle-VeeContactPicker-Info.plist │ │ │ ├── VeeContactPicker-dummy.m │ │ │ ├── VeeContactPicker-prefix.pch │ │ │ ├── VeeContactPicker-umbrella.h │ │ │ ├── VeeContactPicker.modulemap │ │ │ └── VeeContactPicker.xcconfig │ └── UIImageView-AGCInitials │ │ ├── LICENSE │ │ ├── Pod │ │ └── Classes │ │ │ ├── AGCInitialsColors.h │ │ │ ├── AGCInitialsColors.m │ │ │ ├── UIImageView+AGCInitials.h │ │ │ └── UIImageView+AGCInitials.m │ │ └── README.md ├── Tests │ ├── Controller │ │ ├── Address Book │ │ │ └── VeeABRecordsImporterTests.m │ │ └── View Controller │ │ │ ├── UITableViewCells │ │ │ └── VeeContactCellConfigurationTests.m │ │ │ ├── VeeContactPickerViewControllerTests.m │ │ │ └── View Controller utils │ │ │ └── VeeSectionedArrayDataSourceTests.m │ ├── Model │ │ ├── ContactPicker │ │ │ ├── VeeContactPickerOptionsTests.m │ │ │ └── VeeContactPickerStringsTests.m │ │ ├── VeeABRecordTests.m │ │ ├── VeeContactTests.m │ │ └── VeePostalAddressTests.m │ ├── Res │ │ ├── Fake contact entries │ │ │ ├── EmailDomains.txt │ │ │ ├── FakePhoneNumbers.txt │ │ │ ├── FirstNames.txt │ │ │ ├── LastNames.txt │ │ │ ├── MiddleNames.txt │ │ │ ├── Nicknames.txt │ │ │ └── OrganizationNames.txt │ │ ├── vee_test_image.png │ │ └── vee_testing_ab.vcf │ ├── Supporting Files │ │ ├── Tests-Info.plist │ │ ├── Tests-Prefix.pch │ │ └── en.lproj │ │ │ └── InfoPlist.strings │ ├── Testing Utils │ │ ├── AddressBookForTesting │ │ │ ├── VeeAddressBookForTesting.h │ │ │ ├── VeeAddressBookForTesting.m │ │ │ ├── VeeAddressBookForTestingConstants.h │ │ │ └── VeeAddressBookForTestingConstants.m │ │ ├── VeeContactsForTestingFactory.h │ │ ├── VeeContactsForTestingFactory.m │ │ ├── VeeSectionableForTesting.h │ │ ├── VeeSectionableForTesting.m │ │ ├── XCTest+VeeCommons.h │ │ └── XCTest+VeeCommons.m │ ├── Tests-Info.plist │ ├── Tests-Prefix.pch │ ├── Utils and categories │ │ ├── UILabelBolfidyTests.m │ │ └── VeeIsEmptyTests.m │ └── en.lproj │ │ └── InfoPlist.strings ├── VeeContactPicker.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ └── xcshareddata │ │ └── xcschemes │ │ └── VeeContactPicker-Example.xcscheme ├── VeeContactPicker.xcworkspace │ └── contents.xcworkspacedata └── VeeContactPicker │ ├── Base.lproj │ └── LaunchScreen.storyboard │ ├── Images.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json │ ├── Main.storyboard │ ├── VeeAppDelegate.h │ ├── VeeAppDelegate.m │ ├── VeeContactPicker-Info.plist │ ├── VeeContactPicker-Prefix.pch │ ├── VeeContactPickerExampleViewController.h │ ├── VeeContactPickerExampleViewController.m │ ├── en.lproj │ └── InfoPlist.strings │ └── main.m ├── LICENSE ├── README.md ├── RELEASES.md ├── Screenshots ├── VeeContactPicker.gif └── VeeContactPickerScreen1.png ├── VeeContactPicker.podspec ├── VeeContactPicker └── Classes │ ├── .gitkeep │ ├── Controller │ ├── Address Book │ │ ├── VeeABDelegate.h │ │ ├── VeeABRecordsImporter.h │ │ ├── VeeABRecordsImporter.m │ │ ├── VeeAddressBook.h │ │ └── VeeAddressBook.m │ └── ViewController │ │ ├── UITableViewCells │ │ ├── VeeContactCellConfiguration.h │ │ ├── VeeContactCellConfiguration.m │ │ ├── VeeContactTableViewCell.h │ │ ├── VeeContactTableViewCell.m │ │ └── VeeContactTableViewCell.xib │ │ ├── VeeContactPickerDelegate.h │ │ ├── VeeContactPickerViewController.h │ │ ├── VeeContactPickerViewController.m │ │ ├── VeeContactPickerViewController.xib │ │ └── View Controller utils │ │ ├── VeeSectionedArrayDataSource.h │ │ └── VeeSectionedArrayDataSource.m │ ├── Model │ ├── ContactPicker │ │ ├── VeeContactPickerAppearanceConstants.h │ │ ├── VeeContactPickerAppearanceConstants.m │ │ ├── VeeContactPickerOptions.h │ │ ├── VeeContactPickerOptions.m │ │ ├── VeeContactPickerStrings.h │ │ └── VeeContactPickerStrings.m │ ├── VeeABRecord.h │ ├── VeeABRecord.m │ ├── VeeContact Abstract Factory │ │ ├── VeeContactFactory.h │ │ ├── VeeContactFactory.m │ │ ├── VeeContactFactoryProt.h │ │ ├── VeeContactProtFactoryProducer.h │ │ └── VeeContactProtFactoryProducer.m │ ├── VeeContact.h │ ├── VeeContact.m │ ├── VeeContactProt.h │ ├── VeePostalAddress.h │ ├── VeePostalAddress.m │ ├── VeePostalAddressProt.h │ └── VeeSectionable.h │ └── Utils and categories │ ├── NSBundle+VeeContactPicker.h │ ├── NSBundle+VeeContactPicker.m │ ├── NSObject+VeeCommons.h │ ├── NSObject+VeeCommons.m │ ├── UILabel+VeeBoldify.h │ ├── UILabel+VeeBoldify.m │ ├── VeeCommons.h │ └── VeeCommons.m └── _Pods.xcodeproj /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata 19 | 20 | ## Other 21 | *.xccheckout 22 | *.moved-aside 23 | *.xcuserstate 24 | *.xcscmblueprint 25 | 26 | ## Obj-C/Swift specific 27 | *.hmap 28 | *.ipa 29 | 30 | # CocoaPods 31 | # 32 | # We recommend against adding the Pods directory to your .gitignore. However 33 | # you should judge for yourself, the pros and cons are mentioned at: 34 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 35 | # 36 | # Pods/ 37 | 38 | # Carthage 39 | # 40 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 41 | # Carthage/Checkouts 42 | 43 | Carthage/Build 44 | 45 | # fastlane 46 | # 47 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 48 | # screenshots whenever they are needed. 49 | # For more information about the recommended setup visit: 50 | # https://github.com/fastlane/fastlane/blob/master/docs/Gitignore.md 51 | 52 | fastlane/report.xml 53 | fastlane/screenshots 54 | 55 | #AppCode 56 | .idea/ 57 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: objective-c 2 | osx_image: xcode8.3 3 | xcode_project: Example/VeeContactPicker.xcworkspace 4 | podfile: Example/Podfile 5 | cache: cocoapods 6 | 7 | before_install: 8 | - gem install cocoapods --quiet 9 | 10 | script: 11 | - set -o pipefail && xcodebuild test -workspace Example/VeeContactPicker.xcworkspace -destination "platform=iOS Simulator,name=iPhone 7" -scheme VeeContactPicker-Example -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO | xcpretty 12 | - pod lib lint --allow-warnings #--verbose 13 | -------------------------------------------------------------------------------- /Example/Podfile: -------------------------------------------------------------------------------- 1 | use_frameworks! 2 | platform :ios, '8.0' 3 | 4 | target 'VeeContactPicker_Example' do 5 | pod 'VeeContactPicker', :path => '../' 6 | end 7 | 8 | target 'VeeContactPicker_Tests' do 9 | inherit! :search_paths 10 | pod 'VeeContactPicker', :path => '../' 11 | pod 'OCMock' 12 | end 13 | -------------------------------------------------------------------------------- /Example/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - OCMock (3.4) 3 | - UIImageView-AGCInitials (0.0.2) 4 | - VeeContactPicker (0.1.0): 5 | - UIImageView-AGCInitials 6 | 7 | DEPENDENCIES: 8 | - OCMock 9 | - VeeContactPicker (from `../`) 10 | 11 | EXTERNAL SOURCES: 12 | VeeContactPicker: 13 | :path: "../" 14 | 15 | SPEC CHECKSUMS: 16 | OCMock: 35ae71d6a8fcc1b59434d561d1520b9dd4f15765 17 | UIImageView-AGCInitials: 4326faf01587dbfa2ffdee7e596ae96c1beca05c 18 | VeeContactPicker: 2f8ed55a3fe067b72e80b4213936eca30395b74f 19 | 20 | PODFILE CHECKSUM: ec3495030d18a308b9599ceb9f565dde8c1ee237 21 | 22 | COCOAPODS: 1.2.1 23 | -------------------------------------------------------------------------------- /Example/Pods/Local Podspecs/VeeContactPicker.podspec.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "VeeContactPicker", 3 | "version": "0.1.0", 4 | "summary": "A replacement for the iOS ABPeoplePickerNavigationController, with contacts' images", 5 | "description": "VeeContactPicker is a replacement for the (bugged) ABPeoplePickerNavigationController. You can use it to let the user choose a contact from the address book.", 6 | "homepage": "https://github.com/CodeAtlas/VeeContactPicker", 7 | "screenshots": "https://raw.githubusercontent.com/CodeAtlas/VeeContactPicker/master/Screenshots/VeeContactPickerScreen1.png", 8 | "license": "MIT", 9 | "authors": { 10 | "Code Atlas SRL": "andrea.g.cipriani@gmail.com" 11 | }, 12 | "source": { 13 | "git": "https://github.com/CodeAtlas/VeeContactPicker.git", 14 | "tag": "0.1.0" 15 | }, 16 | "social_media_url": "https://github.com/CodeAtlas", 17 | "platforms": { 18 | "ios": "8.0" 19 | }, 20 | "requires_arc": true, 21 | "source_files": "VeeContactPicker/Classes/**/*", 22 | "resource_bundles": { 23 | "VeeContactPicker": [ 24 | "VeeContactPicker/Assets/*.png" 25 | ] 26 | }, 27 | "public_header_files": "Pod/Classes/**/*.h", 28 | "frameworks": [ 29 | "UIKit", 30 | "AddressBook" 31 | ], 32 | "dependencies": { 33 | "UIImageView-AGCInitials": [ 34 | 35 | ] 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Example/Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - OCMock (3.4) 3 | - UIImageView-AGCInitials (0.0.2) 4 | - VeeContactPicker (0.1.0): 5 | - UIImageView-AGCInitials 6 | 7 | DEPENDENCIES: 8 | - OCMock 9 | - VeeContactPicker (from `../`) 10 | 11 | EXTERNAL SOURCES: 12 | VeeContactPicker: 13 | :path: "../" 14 | 15 | SPEC CHECKSUMS: 16 | OCMock: 35ae71d6a8fcc1b59434d561d1520b9dd4f15765 17 | UIImageView-AGCInitials: 4326faf01587dbfa2ffdee7e596ae96c1beca05c 18 | VeeContactPicker: 2f8ed55a3fe067b72e80b4213936eca30395b74f 19 | 20 | PODFILE CHECKSUM: ec3495030d18a308b9599ceb9f565dde8c1ee237 21 | 22 | COCOAPODS: 1.2.1 23 | -------------------------------------------------------------------------------- /Example/Pods/OCMock/README.md: -------------------------------------------------------------------------------- 1 | OCMock 2 | ====== 3 | 4 | OCMock is an Objective-C implementation of mock objects. 5 | 6 | For downloads, documentation, and support please visit [ocmock.org][]. 7 | 8 | [![Build Status](https://travis-ci.org/erikdoe/ocmock.svg?branch=master)](https://travis-ci.org/erikdoe/ocmock) 9 | 10 | [ocmock.org]: http://ocmock.org/ 11 | -------------------------------------------------------------------------------- /Example/Pods/OCMock/Source/OCMock/NSInvocation+OCMAdditions.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | 19 | @interface NSInvocation(OCMAdditions) 20 | 21 | + (NSInvocation *)invocationForBlock:(id)block withArguments:(NSArray *)arguments; 22 | 23 | - (void)retainObjectArgumentsExcludingObject:(id)objectToExclude; 24 | 25 | - (id)getArgumentAtIndexAsObject:(NSInteger)argIndex; 26 | 27 | - (NSString *)invocationDescription; 28 | 29 | - (NSString *)argumentDescriptionAtIndex:(NSInteger)argIndex; 30 | 31 | - (NSString *)objectDescriptionAtIndex:(NSInteger)anInt; 32 | - (NSString *)charDescriptionAtIndex:(NSInteger)anInt; 33 | - (NSString *)unsignedCharDescriptionAtIndex:(NSInteger)anInt; 34 | - (NSString *)intDescriptionAtIndex:(NSInteger)anInt; 35 | - (NSString *)unsignedIntDescriptionAtIndex:(NSInteger)anInt; 36 | - (NSString *)shortDescriptionAtIndex:(NSInteger)anInt; 37 | - (NSString *)unsignedShortDescriptionAtIndex:(NSInteger)anInt; 38 | - (NSString *)longDescriptionAtIndex:(NSInteger)anInt; 39 | - (NSString *)unsignedLongDescriptionAtIndex:(NSInteger)anInt; 40 | - (NSString *)longLongDescriptionAtIndex:(NSInteger)anInt; 41 | - (NSString *)unsignedLongLongDescriptionAtIndex:(NSInteger)anInt; 42 | - (NSString *)doubleDescriptionAtIndex:(NSInteger)anInt; 43 | - (NSString *)floatDescriptionAtIndex:(NSInteger)anInt; 44 | - (NSString *)structDescriptionAtIndex:(NSInteger)anInt; 45 | - (NSString *)pointerDescriptionAtIndex:(NSInteger)anInt; 46 | - (NSString *)cStringDescriptionAtIndex:(NSInteger)anInt; 47 | - (NSString *)selectorDescriptionAtIndex:(NSInteger)anInt; 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /Example/Pods/OCMock/Source/OCMock/NSMethodSignature+OCMAdditions.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | 19 | @interface NSMethodSignature(OCMAdditions) 20 | 21 | + (NSMethodSignature *)signatureForDynamicPropertyAccessedWithSelector:(SEL)selector inClass:(Class)aClass; 22 | + (NSMethodSignature *)signatureForBlock:(id)block; 23 | 24 | - (BOOL)usesSpecialStructureReturn; 25 | 26 | - (NSString *)fullTypeString; 27 | - (const char *)fullObjCTypes; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /Example/Pods/OCMock/Source/OCMock/NSNotificationCenter+OCMAdditions.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | 19 | @class OCObserverMockObject; 20 | 21 | 22 | @interface NSNotificationCenter(OCMAdditions) 23 | 24 | - (void)addMockObserver:(OCObserverMockObject *)notificationObserver name:(NSString *)notificationName object:(id)notificationSender; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /Example/Pods/OCMock/Source/OCMock/NSNotificationCenter+OCMAdditions.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import "NSNotificationCenter+OCMAdditions.h" 18 | #import "OCObserverMockObject.h" 19 | 20 | 21 | @implementation NSNotificationCenter(OCMAdditions) 22 | 23 | - (void)addMockObserver:(OCObserverMockObject *)notificationObserver name:(NSString *)notificationName object:(id)notificationSender 24 | { 25 | [notificationObserver autoRemoveFromCenter:self]; 26 | [self addObserver:notificationObserver selector:@selector(handleNotification:) name:notificationName object:notificationSender]; 27 | } 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /Example/Pods/OCMock/Source/OCMock/NSObject+OCMAdditions.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | 19 | @interface NSObject(OCMAdditions) 20 | 21 | + (IMP)instanceMethodForwarderForSelector:(SEL)aSelector; 22 | + (void)enumerateMethodsInClass:(Class)aClass usingBlock:(void (^)(Class cls, SEL sel))aBlock; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /Example/Pods/OCMock/Source/OCMock/NSObject+OCMAdditions.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import "NSObject+OCMAdditions.h" 18 | #import "NSMethodSignature+OCMAdditions.h" 19 | #import 20 | 21 | @implementation NSObject(OCMAdditions) 22 | 23 | + (IMP)instanceMethodForwarderForSelector:(SEL)aSelector 24 | { 25 | // use sel_registerName() and not @selector to avoid warning 26 | SEL selectorWithNoImplementation = sel_registerName("methodWhichMustNotExist::::"); 27 | 28 | #ifndef __arm64__ 29 | static NSMutableDictionary *_OCMReturnTypeCache; 30 | 31 | if(_OCMReturnTypeCache == nil) 32 | _OCMReturnTypeCache = [[NSMutableDictionary alloc] init]; 33 | 34 | BOOL needsStructureReturn; 35 | void *rawCacheKey[2] = { (void *)self, aSelector }; 36 | NSData *cacheKey = [NSData dataWithBytes:rawCacheKey length:sizeof(rawCacheKey)]; 37 | NSNumber *cachedValue = [_OCMReturnTypeCache objectForKey:cacheKey]; 38 | 39 | if(cachedValue == nil) 40 | { 41 | NSMethodSignature *sig = [self instanceMethodSignatureForSelector:aSelector]; 42 | needsStructureReturn = [sig usesSpecialStructureReturn]; 43 | [_OCMReturnTypeCache setObject:@(needsStructureReturn) forKey:cacheKey]; 44 | } 45 | else 46 | { 47 | needsStructureReturn = [cachedValue boolValue]; 48 | } 49 | 50 | if(needsStructureReturn) 51 | return class_getMethodImplementation_stret([NSObject class], selectorWithNoImplementation); 52 | #endif 53 | 54 | return class_getMethodImplementation([NSObject class], selectorWithNoImplementation); 55 | } 56 | 57 | 58 | + (void)enumerateMethodsInClass:(Class)aClass usingBlock:(void (^)(Class cls, SEL sel))aBlock 59 | { 60 | for(Class cls = aClass; cls != nil; cls = class_getSuperclass(cls)) 61 | { 62 | Method *methodList = class_copyMethodList(cls, NULL); 63 | if(methodList == NULL) 64 | continue; 65 | 66 | for(Method *mPtr = methodList; *mPtr != NULL; mPtr++) 67 | { 68 | SEL sel = method_getName(*mPtr); 69 | aBlock(cls, sel); 70 | } 71 | free(methodList); 72 | } 73 | } 74 | 75 | 76 | @end 77 | -------------------------------------------------------------------------------- /Example/Pods/OCMock/Source/OCMock/NSValue+OCMAdditions.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | 19 | @interface NSValue(OCMAdditions) 20 | 21 | - (BOOL)getBytes:(void *)outputBuf objCType:(const char *)targetType; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /Example/Pods/OCMock/Source/OCMock/NSValue+OCMAdditions.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import "NSValue+OCMAdditions.h" 18 | #import "OCMFunctionsPrivate.h" 19 | 20 | @implementation NSValue(OCMAdditions) 21 | 22 | static NSNumber *OCMNumberForValue(NSValue *value) 23 | { 24 | #define CREATE_NUM(_type) ({ _type _v; [value getValue:&_v]; @(_v); }) 25 | switch([value objCType][0]) 26 | { 27 | case 'c': return CREATE_NUM(char); 28 | case 'C': return CREATE_NUM(unsigned char); 29 | case 'B': return CREATE_NUM(bool); 30 | case 's': return CREATE_NUM(short); 31 | case 'S': return CREATE_NUM(unsigned short); 32 | case 'i': return CREATE_NUM(int); 33 | case 'I': return CREATE_NUM(unsigned int); 34 | case 'l': return CREATE_NUM(long); 35 | case 'L': return CREATE_NUM(unsigned long); 36 | case 'q': return CREATE_NUM(long long); 37 | case 'Q': return CREATE_NUM(unsigned long long); 38 | case 'f': return CREATE_NUM(float); 39 | case 'd': return CREATE_NUM(double); 40 | default: return nil; 41 | } 42 | } 43 | 44 | 45 | - (BOOL)getBytes:(void *)outputBuf objCType:(const char *)targetType 46 | { 47 | /* 48 | * See if they are similar number types, and if we can convert losslessly between them. 49 | * For the most part, we set things up to use CFNumberGetValue, which returns false if 50 | * conversion will be lossy. 51 | */ 52 | CFNumberType inputType = OCMNumberTypeForObjCType([self objCType]); 53 | CFNumberType outputType = OCMNumberTypeForObjCType(targetType); 54 | 55 | if(inputType == 0 || outputType == 0) // one or both are non-number types 56 | return NO; 57 | 58 | NSNumber *inputNumber = [self isKindOfClass:[NSNumber class]] ? (NSNumber *)self : OCMNumberForValue(self); 59 | 60 | /* 61 | * Due to some legacy, back-compatible requirements in CFNumber.c, CFNumberGetValue can return true for 62 | * some conversions which should not be allowed (by reading source, conversions from integer types to 63 | * 8-bit or 16-bit integer types). So, check ourselves. 64 | */ 65 | long long min; 66 | long long max; 67 | long long val = [inputNumber longLongValue]; 68 | switch(targetType[0]) 69 | { 70 | case 'B': 71 | case 'c': min = CHAR_MIN; max = CHAR_MAX; break; 72 | case 'C': min = 0; max = UCHAR_MAX; break; 73 | case 's': min = SHRT_MIN; max = SHRT_MAX; break; 74 | case 'S': min = 0; max = USHRT_MAX; break; 75 | default: min = LLONG_MIN; max = LLONG_MAX; break; 76 | } 77 | if(val < min || val > max) 78 | return NO; 79 | 80 | /* Get the number, and return NO if the value was out of range or conversion was lossy */ 81 | return CFNumberGetValue((CFNumberRef)inputNumber, outputType, outputBuf); 82 | } 83 | 84 | 85 | @end 86 | -------------------------------------------------------------------------------- /Example/Pods/OCMock/Source/OCMock/OCClassMockObject.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2005-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | 19 | @interface OCClassMockObject : OCMockObject 20 | { 21 | Class mockedClass; 22 | Class originalMetaClass; 23 | } 24 | 25 | - (id)initWithClass:(Class)aClass; 26 | 27 | - (Class)mockedClass; 28 | - (Class)mockObjectClass; // since -class returns the mockedClass 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /Example/Pods/OCMock/Source/OCMock/OCMArg.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | 19 | @interface OCMArg : NSObject 20 | 21 | // constraining arguments 22 | 23 | + (id)any; 24 | + (SEL)anySelector; 25 | + (void *)anyPointer; 26 | + (id __autoreleasing *)anyObjectRef; 27 | + (id)isNil; 28 | + (id)isNotNil; 29 | + (id)isEqual:(id)value; 30 | + (id)isNotEqual:(id)value; 31 | + (id)isKindOfClass:(Class)cls; 32 | + (id)checkWithSelector:(SEL)selector onObject:(id)anObject; 33 | + (id)checkWithBlock:(BOOL (^)(id obj))block; 34 | 35 | // manipulating arguments 36 | 37 | + (id *)setTo:(id)value; 38 | + (void *)setToValue:(NSValue *)value; 39 | + (id)invokeBlock; 40 | + (id)invokeBlockWithArgs:(id)first,... NS_REQUIRES_NIL_TERMINATION; 41 | 42 | + (id)defaultValue; 43 | 44 | // internal use only 45 | 46 | + (id)resolveSpecialValues:(NSValue *)value; 47 | 48 | @end 49 | 50 | #define OCMOCK_ANY [OCMArg any] 51 | 52 | #if defined(__GNUC__) && !defined(__STRICT_ANSI__) 53 | #define OCMOCK_VALUE(variable) \ 54 | ({ __typeof__(variable) __v = (variable); [NSValue value:&__v withObjCType:@encode(__typeof__(__v))]; }) 55 | #else 56 | #define OCMOCK_VALUE(variable) [NSValue value:&variable withObjCType:@encode(__typeof__(variable))] 57 | #endif 58 | 59 | -------------------------------------------------------------------------------- /Example/Pods/OCMock/Source/OCMock/OCMArgAction.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | 19 | @interface OCMArgAction : NSObject 20 | 21 | - (void)handleArgument:(id)argument; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /Example/Pods/OCMock/Source/OCMock/OCMArgAction.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import "OCMArgAction.h" 18 | 19 | 20 | @implementation OCMArgAction 21 | 22 | - (void)handleArgument:(id)argument 23 | { 24 | 25 | } 26 | 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /Example/Pods/OCMock/Source/OCMock/OCMBlockArgCaller.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import "OCMArgAction.h" 18 | 19 | @interface OCMBlockArgCaller : OCMArgAction 20 | { 21 | NSArray *arguments; 22 | } 23 | 24 | - (instancetype)initWithBlockArguments:(NSArray *)someArgs; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /Example/Pods/OCMock/Source/OCMock/OCMBlockArgCaller.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import "OCMBlockArgCaller.h" 18 | #import "NSInvocation+OCMAdditions.h" 19 | 20 | 21 | @implementation OCMBlockArgCaller 22 | 23 | - (instancetype)initWithBlockArguments:(NSArray *)someArgs 24 | { 25 | self = [super init]; 26 | if(self) 27 | { 28 | arguments = [someArgs copy]; 29 | } 30 | return self; 31 | } 32 | 33 | - (void)dealloc 34 | { 35 | [arguments release]; 36 | [super dealloc]; 37 | } 38 | 39 | - (id)copyWithZone:(NSZone *)zone 40 | { 41 | return [self retain]; 42 | } 43 | 44 | - (void)handleArgument:(id)aBlock 45 | { 46 | if(aBlock) 47 | { 48 | NSInvocation *inv = [NSInvocation invocationForBlock:aBlock withArguments:arguments]; 49 | [inv invokeWithTarget:aBlock]; 50 | } 51 | } 52 | 53 | @end 54 | -------------------------------------------------------------------------------- /Example/Pods/OCMock/Source/OCMock/OCMBlockCaller.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | 19 | 20 | @interface OCMBlockCaller : NSObject 21 | { 22 | void (^block)(NSInvocation *); 23 | } 24 | 25 | - (id)initWithCallBlock:(void (^)(NSInvocation *))theBlock; 26 | 27 | - (void)handleInvocation:(NSInvocation *)anInvocation; 28 | 29 | @end 30 | 31 | -------------------------------------------------------------------------------- /Example/Pods/OCMock/Source/OCMock/OCMBlockCaller.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import "OCMBlockCaller.h" 18 | 19 | 20 | @implementation OCMBlockCaller 21 | 22 | -(id)initWithCallBlock:(void (^)(NSInvocation *))theBlock 23 | { 24 | if ((self = [super init])) 25 | { 26 | block = [theBlock copy]; 27 | } 28 | 29 | return self; 30 | } 31 | 32 | -(void)dealloc 33 | { 34 | [block release]; 35 | [super dealloc]; 36 | } 37 | 38 | - (void)handleInvocation:(NSInvocation *)anInvocation 39 | { 40 | if (block != nil) 41 | { 42 | block(anInvocation); 43 | } 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /Example/Pods/OCMock/Source/OCMock/OCMBoxedReturnValueProvider.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import "OCMReturnValueProvider.h" 18 | 19 | @interface OCMBoxedReturnValueProvider : OCMReturnValueProvider 20 | { 21 | } 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /Example/Pods/OCMock/Source/OCMock/OCMBoxedReturnValueProvider.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import "OCMBoxedReturnValueProvider.h" 18 | #import "OCMFunctionsPrivate.h" 19 | #import "NSValue+OCMAdditions.h" 20 | 21 | @implementation OCMBoxedReturnValueProvider 22 | 23 | - (void)handleInvocation:(NSInvocation *)anInvocation 24 | { 25 | const char *returnType = [[anInvocation methodSignature] methodReturnType]; 26 | NSUInteger returnTypeSize = [[anInvocation methodSignature] methodReturnLength]; 27 | char valueBuffer[returnTypeSize]; 28 | NSValue *returnValueAsNSValue = (NSValue *)returnValue; 29 | 30 | if([self isMethodReturnType:returnType compatibleWithValueType:[returnValueAsNSValue objCType]]) 31 | { 32 | [returnValueAsNSValue getValue:valueBuffer]; 33 | [anInvocation setReturnValue:valueBuffer]; 34 | } 35 | else if([returnValueAsNSValue getBytes:valueBuffer objCType:returnType]) 36 | { 37 | [anInvocation setReturnValue:valueBuffer]; 38 | } 39 | else 40 | { 41 | [NSException raise:NSInvalidArgumentException 42 | format:@"Return value cannot be used for method; method signature declares '%s' but value is '%s'.", returnType, [returnValueAsNSValue objCType]]; 43 | } 44 | } 45 | 46 | 47 | - (BOOL)isMethodReturnType:(const char *)returnType compatibleWithValueType:(const char *)valueType 48 | { 49 | /* Same types are obviously compatible */ 50 | if(strcmp(returnType, valueType) == 0) 51 | return YES; 52 | 53 | /* Allow void* for methods that return id, mainly to be able to handle nil */ 54 | if(strcmp(returnType, @encode(id)) == 0 && strcmp(valueType, @encode(void *)) == 0) 55 | return YES; 56 | 57 | return OCMEqualTypesAllowingOpaqueStructs(returnType, valueType); 58 | } 59 | 60 | 61 | @end 62 | -------------------------------------------------------------------------------- /Example/Pods/OCMock/Source/OCMock/OCMConstraint.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | 19 | 20 | @interface OCMConstraint : NSObject 21 | 22 | + (instancetype)constraint; 23 | - (BOOL)evaluate:(id)value; 24 | 25 | // if you are looking for any, isNil, etc, they have moved to OCMArg 26 | 27 | // try to use [OCMArg checkWith...] instead of the constraintWith... methods below 28 | 29 | + (instancetype)constraintWithSelector:(SEL)aSelector onObject:(id)anObject; 30 | + (instancetype)constraintWithSelector:(SEL)aSelector onObject:(id)anObject withValue:(id)aValue; 31 | 32 | 33 | @end 34 | 35 | @interface OCMAnyConstraint : OCMConstraint 36 | @end 37 | 38 | @interface OCMIsNilConstraint : OCMConstraint 39 | @end 40 | 41 | @interface OCMIsNotNilConstraint : OCMConstraint 42 | @end 43 | 44 | @interface OCMIsNotEqualConstraint : OCMConstraint 45 | { 46 | @public 47 | id testValue; 48 | } 49 | 50 | @end 51 | 52 | @interface OCMInvocationConstraint : OCMConstraint 53 | { 54 | @public 55 | NSInvocation *invocation; 56 | } 57 | 58 | @end 59 | 60 | @interface OCMBlockConstraint : OCMConstraint 61 | { 62 | BOOL (^block)(id); 63 | } 64 | 65 | - (instancetype)initWithConstraintBlock:(BOOL (^)(id))block; 66 | 67 | @end 68 | 69 | 70 | #define CONSTRAINT(aSelector) [OCMConstraint constraintWithSelector:aSelector onObject:self] 71 | #define CONSTRAINTV(aSelector, aValue) [OCMConstraint constraintWithSelector:aSelector onObject:self withValue:(aValue)] 72 | -------------------------------------------------------------------------------- /Example/Pods/OCMock/Source/OCMock/OCMConstraint.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | 19 | 20 | @implementation OCMConstraint 21 | 22 | + (instancetype)constraint 23 | { 24 | return [[[self alloc] init] autorelease]; 25 | } 26 | 27 | - (BOOL)evaluate:(id)value 28 | { 29 | return NO; 30 | } 31 | 32 | - (id)copyWithZone:(struct _NSZone *)zone 33 | { 34 | return [self retain]; 35 | } 36 | 37 | + (instancetype)constraintWithSelector:(SEL)aSelector onObject:(id)anObject 38 | { 39 | OCMInvocationConstraint *constraint = [OCMInvocationConstraint constraint]; 40 | NSMethodSignature *signature = [anObject methodSignatureForSelector:aSelector]; 41 | if(signature == nil) 42 | [NSException raise:NSInvalidArgumentException format:@"Unkown selector %@ used in constraint.", NSStringFromSelector(aSelector)]; 43 | NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature]; 44 | [invocation setTarget:anObject]; 45 | [invocation setSelector:aSelector]; 46 | constraint->invocation = invocation; 47 | return constraint; 48 | } 49 | 50 | + (instancetype)constraintWithSelector:(SEL)aSelector onObject:(id)anObject withValue:(id)aValue 51 | { 52 | OCMInvocationConstraint *constraint = [self constraintWithSelector:aSelector onObject:anObject]; 53 | if([[constraint->invocation methodSignature] numberOfArguments] < 4) 54 | [NSException raise:NSInvalidArgumentException format:@"Constraint with value requires selector with two arguments."]; 55 | [constraint->invocation setArgument:&aValue atIndex:3]; 56 | return constraint; 57 | } 58 | 59 | 60 | @end 61 | 62 | 63 | 64 | #pragma mark - 65 | 66 | @implementation OCMAnyConstraint 67 | 68 | - (BOOL)evaluate:(id)value 69 | { 70 | return YES; 71 | } 72 | 73 | @end 74 | 75 | 76 | 77 | #pragma mark - 78 | 79 | @implementation OCMIsNilConstraint 80 | 81 | - (BOOL)evaluate:(id)value 82 | { 83 | return value == nil; 84 | } 85 | 86 | @end 87 | 88 | 89 | 90 | #pragma mark - 91 | 92 | @implementation OCMIsNotNilConstraint 93 | 94 | - (BOOL)evaluate:(id)value 95 | { 96 | return value != nil; 97 | } 98 | 99 | @end 100 | 101 | 102 | 103 | #pragma mark - 104 | 105 | @implementation OCMIsNotEqualConstraint 106 | 107 | - (BOOL)evaluate:(id)value 108 | { 109 | return ![value isEqual:testValue]; 110 | } 111 | 112 | @end 113 | 114 | 115 | 116 | #pragma mark - 117 | 118 | @implementation OCMInvocationConstraint 119 | 120 | - (BOOL)evaluate:(id)value 121 | { 122 | [invocation setArgument:&value atIndex:2]; // should test if constraint takes arg 123 | [invocation invoke]; 124 | BOOL returnValue; 125 | [invocation getReturnValue:&returnValue]; 126 | return returnValue; 127 | } 128 | 129 | @end 130 | 131 | #pragma mark - 132 | 133 | @implementation OCMBlockConstraint 134 | 135 | - (instancetype)initWithConstraintBlock:(BOOL (^)(id))aBlock 136 | { 137 | if ((self = [super init])) 138 | { 139 | block = [aBlock copy]; 140 | } 141 | 142 | return self; 143 | } 144 | 145 | - (void)dealloc { 146 | [block release]; 147 | [super dealloc]; 148 | } 149 | 150 | - (BOOL)evaluate:(id)value 151 | { 152 | return block ? block(value) : NO; 153 | } 154 | 155 | 156 | @end 157 | -------------------------------------------------------------------------------- /Example/Pods/OCMock/Source/OCMock/OCMExceptionReturnValueProvider.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import "OCMReturnValueProvider.h" 18 | 19 | extern NSString *OCMStubbedException; 20 | 21 | @interface OCMExceptionReturnValueProvider : OCMReturnValueProvider 22 | { 23 | } 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /Example/Pods/OCMock/Source/OCMock/OCMExceptionReturnValueProvider.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import "OCMExceptionReturnValueProvider.h" 18 | 19 | 20 | @implementation OCMExceptionReturnValueProvider 21 | 22 | NSString *OCMStubbedException = @"OCMStubbedException"; 23 | 24 | 25 | - (void)handleInvocation:(NSInvocation *)anInvocation 26 | { 27 | [[NSException exceptionWithName:OCMStubbedException reason:@"Exception stubbed in test." userInfo:@{ @"exception": returnValue }] raise]; 28 | } 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /Example/Pods/OCMock/Source/OCMock/OCMExpectationRecorder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | 19 | @interface OCMExpectationRecorder : OCMStubRecorder 20 | 21 | - (id)never; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /Example/Pods/OCMock/Source/OCMock/OCMExpectationRecorder.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import "OCMExpectationRecorder.h" 18 | #import "OCMInvocationExpectation.h" 19 | 20 | @implementation OCMExpectationRecorder 21 | 22 | #pragma mark Initialisers, description, accessors, etc. 23 | 24 | - (id)init 25 | { 26 | self = [super init]; 27 | [invocationMatcher release]; 28 | invocationMatcher = [[OCMInvocationExpectation alloc] init]; 29 | return self; 30 | } 31 | 32 | - (OCMInvocationExpectation *)expectation 33 | { 34 | return (OCMInvocationExpectation *)invocationMatcher; 35 | } 36 | 37 | 38 | #pragma mark Modifying the expectation 39 | 40 | - (id)never 41 | { 42 | [[self expectation] setMatchAndReject:YES]; 43 | return self; 44 | } 45 | 46 | 47 | #pragma mark Finishing recording 48 | 49 | - (void)forwardInvocation:(NSInvocation *)anInvocation 50 | { 51 | [super forwardInvocation:anInvocation]; 52 | [mockObject addExpectation:[self expectation]]; 53 | } 54 | 55 | 56 | @end 57 | -------------------------------------------------------------------------------- /Example/Pods/OCMock/Source/OCMock/OCMFunctions.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | 19 | 20 | #if defined(__cplusplus) 21 | #define OCMOCK_EXTERN extern "C" 22 | #else 23 | #define OCMOCK_EXTERN extern 24 | #endif 25 | 26 | 27 | OCMOCK_EXTERN BOOL OCMIsObjectType(const char *objCType); 28 | -------------------------------------------------------------------------------- /Example/Pods/OCMock/Source/OCMock/OCMFunctionsPrivate.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | 19 | @class OCMLocation; 20 | @class OCClassMockObject; 21 | @class OCPartialMockObject; 22 | 23 | 24 | BOOL OCMIsClassType(const char *objCType); 25 | BOOL OCMIsBlockType(const char *objCType); 26 | BOOL OCMIsObjectType(const char *objCType); 27 | const char *OCMTypeWithoutQualifiers(const char *objCType); 28 | BOOL OCMEqualTypesAllowingOpaqueStructs(const char *type1, const char *type2); 29 | CFNumberType OCMNumberTypeForObjCType(const char *objcType); 30 | 31 | Class OCMCreateSubclass(Class cls, void *ref); 32 | 33 | BOOL OCMIsAliasSelector(SEL selector); 34 | SEL OCMAliasForOriginalSelector(SEL selector); 35 | SEL OCMOriginalSelectorForAlias(SEL selector); 36 | 37 | void OCMSetAssociatedMockForClass(OCClassMockObject *mock, Class aClass); 38 | OCClassMockObject *OCMGetAssociatedMockForClass(Class aClass, BOOL includeSuperclasses); 39 | 40 | void OCMSetAssociatedMockForObject(OCClassMockObject *mock, id anObject); 41 | OCPartialMockObject *OCMGetAssociatedMockForObject(id anObject); 42 | 43 | void OCMReportFailure(OCMLocation *loc, NSString *description); 44 | -------------------------------------------------------------------------------- /Example/Pods/OCMock/Source/OCMock/OCMIndirectReturnValueProvider.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | 19 | @interface OCMIndirectReturnValueProvider : NSObject 20 | { 21 | id provider; 22 | SEL selector; 23 | } 24 | 25 | - (id)initWithProvider:(id)aProvider andSelector:(SEL)aSelector; 26 | 27 | - (void)handleInvocation:(NSInvocation *)anInvocation; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /Example/Pods/OCMock/Source/OCMock/OCMIndirectReturnValueProvider.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import "NSMethodSignature+OCMAdditions.h" 18 | #import "OCMIndirectReturnValueProvider.h" 19 | #import "NSInvocation+OCMAdditions.h" 20 | 21 | 22 | @implementation OCMIndirectReturnValueProvider 23 | 24 | - (id)initWithProvider:(id)aProvider andSelector:(SEL)aSelector 25 | { 26 | if ((self = [super init])) 27 | { 28 | provider = [aProvider retain]; 29 | selector = aSelector; 30 | } 31 | 32 | return self; 33 | } 34 | 35 | - (void)dealloc 36 | { 37 | [provider release]; 38 | [super dealloc]; 39 | } 40 | 41 | - (void)handleInvocation:(NSInvocation *)anInvocation 42 | { 43 | id originalTarget = [anInvocation target]; 44 | SEL originalSelector = [anInvocation selector]; 45 | 46 | [anInvocation setTarget:provider]; 47 | [anInvocation setSelector:selector]; 48 | [anInvocation invoke]; 49 | 50 | [anInvocation setTarget:originalTarget]; 51 | [anInvocation setSelector:originalSelector]; 52 | } 53 | 54 | @end 55 | -------------------------------------------------------------------------------- /Example/Pods/OCMock/Source/OCMock/OCMInvocationExpectation.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import "OCMInvocationStub.h" 18 | 19 | @interface OCMInvocationExpectation : OCMInvocationStub 20 | { 21 | BOOL matchAndReject; 22 | BOOL isSatisfied; 23 | } 24 | 25 | - (void)setMatchAndReject:(BOOL)flag; 26 | - (BOOL)isMatchAndReject; 27 | 28 | - (BOOL)isSatisfied; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /Example/Pods/OCMock/Source/OCMock/OCMInvocationExpectation.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import "OCMInvocationExpectation.h" 18 | #import "NSInvocation+OCMAdditions.h" 19 | 20 | 21 | @implementation OCMInvocationExpectation 22 | 23 | - (void)setMatchAndReject:(BOOL)flag 24 | { 25 | matchAndReject = flag; 26 | if(matchAndReject) 27 | isSatisfied = YES; 28 | } 29 | 30 | - (BOOL)isMatchAndReject 31 | { 32 | return matchAndReject; 33 | } 34 | 35 | - (BOOL)isSatisfied 36 | { 37 | return isSatisfied; 38 | } 39 | 40 | - (void)handleInvocation:(NSInvocation *)anInvocation 41 | { 42 | [super handleInvocation:anInvocation]; 43 | 44 | if(matchAndReject) 45 | { 46 | isSatisfied = NO; 47 | [NSException raise:NSInternalInconsistencyException format:@"%@: explicitly disallowed method invoked: %@", 48 | [self description], [anInvocation invocationDescription]]; 49 | } 50 | else 51 | { 52 | isSatisfied = YES; 53 | } 54 | } 55 | 56 | @end 57 | -------------------------------------------------------------------------------- /Example/Pods/OCMock/Source/OCMock/OCMInvocationMatcher.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | 19 | @interface OCMInvocationMatcher : NSObject 20 | { 21 | NSInvocation *recordedInvocation; 22 | BOOL recordedAsClassMethod; 23 | BOOL ignoreNonObjectArgs; 24 | } 25 | 26 | - (void)setInvocation:(NSInvocation *)anInvocation; 27 | - (NSInvocation *)recordedInvocation; 28 | 29 | - (void)setRecordedAsClassMethod:(BOOL)flag; 30 | - (BOOL)recordedAsClassMethod; 31 | 32 | - (void)setIgnoreNonObjectArgs:(BOOL)flag; 33 | 34 | - (BOOL)matchesSelector:(SEL)aSelector; 35 | - (BOOL)matchesInvocation:(NSInvocation *)anInvocation; 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /Example/Pods/OCMock/Source/OCMock/OCMInvocationStub.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import "OCMInvocationMatcher.h" 18 | 19 | @interface OCMInvocationStub : OCMInvocationMatcher 20 | { 21 | NSMutableArray *invocationActions; 22 | } 23 | 24 | - (void)addInvocationAction:(id)anAction; 25 | - (NSArray *)invocationActions; 26 | 27 | - (void)handleInvocation:(NSInvocation *)anInvocation; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /Example/Pods/OCMock/Source/OCMock/OCMInvocationStub.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import "OCMInvocationStub.h" 18 | #import "OCMFunctionsPrivate.h" 19 | #import "OCMArg.h" 20 | #import "OCMArgAction.h" 21 | #import "NSInvocation+OCMAdditions.h" 22 | 23 | @implementation OCMInvocationStub 24 | 25 | - (id)init 26 | { 27 | self = [super init]; 28 | invocationActions = [[NSMutableArray alloc] init]; 29 | return self; 30 | } 31 | 32 | - (void)dealloc 33 | { 34 | [invocationActions release]; 35 | [super dealloc]; 36 | } 37 | 38 | 39 | - (void)addInvocationAction:(id)anAction 40 | { 41 | [invocationActions addObject:anAction]; 42 | } 43 | 44 | - (NSArray *)invocationActions 45 | { 46 | return invocationActions; 47 | } 48 | 49 | 50 | - (void)handleInvocation:(NSInvocation *)anInvocation 51 | { 52 | NSMethodSignature *signature = [recordedInvocation methodSignature]; 53 | NSUInteger n = [signature numberOfArguments]; 54 | for(NSUInteger i = 2; i < n; i++) 55 | { 56 | id recordedArg = [recordedInvocation getArgumentAtIndexAsObject:i]; 57 | id passedArg = [anInvocation getArgumentAtIndexAsObject:i]; 58 | 59 | if([recordedArg isProxy]) 60 | continue; 61 | 62 | if([recordedArg isKindOfClass:[NSValue class]]) 63 | recordedArg = [OCMArg resolveSpecialValues:recordedArg]; 64 | 65 | if(![recordedArg isKindOfClass:[OCMArgAction class]]) 66 | continue; 67 | 68 | [recordedArg handleArgument:passedArg]; 69 | } 70 | 71 | [invocationActions makeObjectsPerformSelector:@selector(handleInvocation:) withObject:anInvocation]; 72 | } 73 | 74 | @end 75 | -------------------------------------------------------------------------------- /Example/Pods/OCMock/Source/OCMock/OCMLocation.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | #import "OCMFunctions.h" 19 | 20 | 21 | @interface OCMLocation : NSObject 22 | { 23 | id testCase; 24 | NSString *file; 25 | NSUInteger line; 26 | } 27 | 28 | + (instancetype)locationWithTestCase:(id)aTestCase file:(NSString *)aFile line:(NSUInteger)aLine; 29 | 30 | - (instancetype)initWithTestCase:(id)aTestCase file:(NSString *)aFile line:(NSUInteger)aLine; 31 | 32 | - (id)testCase; 33 | - (NSString *)file; 34 | - (NSUInteger)line; 35 | 36 | @end 37 | 38 | OCMOCK_EXTERN OCMLocation *OCMMakeLocation(id testCase, const char *file, int line); 39 | -------------------------------------------------------------------------------- /Example/Pods/OCMock/Source/OCMock/OCMLocation.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import "OCMLocation.h" 18 | 19 | @implementation OCMLocation 20 | 21 | + (instancetype)locationWithTestCase:(id)aTestCase file:(NSString *)aFile line:(NSUInteger)aLine 22 | { 23 | return [[[OCMLocation alloc] initWithTestCase:aTestCase file:aFile line:aLine] autorelease]; 24 | } 25 | 26 | - (instancetype)initWithTestCase:(id)aTestCase file:(NSString *)aFile line:(NSUInteger)aLine 27 | { 28 | if ((self = [super init])) 29 | { 30 | testCase = aTestCase; 31 | file = [aFile retain]; 32 | line = aLine; 33 | } 34 | 35 | return self; 36 | } 37 | 38 | - (void)dealloc 39 | { 40 | [file release]; 41 | [super dealloc]; 42 | } 43 | 44 | - (id)testCase 45 | { 46 | return testCase; 47 | } 48 | 49 | - (NSString *)file 50 | { 51 | return file; 52 | } 53 | 54 | - (NSUInteger)line 55 | { 56 | return line; 57 | } 58 | 59 | @end 60 | 61 | 62 | OCMLocation *OCMMakeLocation(id testCase, const char *fileCString, int line) 63 | { 64 | return [OCMLocation locationWithTestCase:testCase file:[NSString stringWithUTF8String:fileCString] line:line]; 65 | } 66 | 67 | -------------------------------------------------------------------------------- /Example/Pods/OCMock/Source/OCMock/OCMMacroState.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | 19 | @class OCMLocation; 20 | @class OCMRecorder; 21 | @class OCMStubRecorder; 22 | @class OCMockObject; 23 | 24 | 25 | @interface OCMMacroState : NSObject 26 | { 27 | OCMRecorder *recorder; 28 | } 29 | 30 | + (void)beginStubMacro; 31 | + (OCMStubRecorder *)endStubMacro; 32 | 33 | + (void)beginExpectMacro; 34 | + (OCMStubRecorder *)endExpectMacro; 35 | 36 | + (void)beginRejectMacro; 37 | + (OCMStubRecorder *)endRejectMacro; 38 | 39 | + (void)beginVerifyMacroAtLocation:(OCMLocation *)aLocation; 40 | + (void)endVerifyMacro; 41 | 42 | + (OCMMacroState *)globalState; 43 | 44 | - (OCMRecorder *)recorder; 45 | 46 | - (void)switchToClassMethod; 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /Example/Pods/OCMock/Source/OCMock/OCMNotificationPoster.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | 19 | @interface OCMNotificationPoster : NSObject 20 | { 21 | NSNotification *notification; 22 | } 23 | 24 | - (id)initWithNotification:(id)aNotification; 25 | 26 | - (void)handleInvocation:(NSInvocation *)anInvocation; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /Example/Pods/OCMock/Source/OCMock/OCMNotificationPoster.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import "OCMNotificationPoster.h" 18 | 19 | 20 | @implementation OCMNotificationPoster 21 | 22 | - (id)initWithNotification:(id)aNotification 23 | { 24 | if ((self = [super init])) 25 | { 26 | notification = [aNotification retain]; 27 | } 28 | 29 | return self; 30 | } 31 | 32 | - (void)dealloc 33 | { 34 | [notification release]; 35 | [super dealloc]; 36 | } 37 | 38 | - (void)handleInvocation:(NSInvocation *)anInvocation 39 | { 40 | [[NSNotificationCenter defaultCenter] postNotification:notification]; 41 | } 42 | 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /Example/Pods/OCMock/Source/OCMock/OCMObserverRecorder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | 19 | @interface OCMObserverRecorder : NSObject 20 | { 21 | NSNotification *recordedNotification; 22 | } 23 | 24 | - (NSNotification *)notificationWithName:(NSString *)name object:(id)sender; 25 | 26 | - (NSNotification *)notificationWithName:(NSString *)name object:(id)sender userInfo:(NSDictionary *)userInfo; 27 | 28 | - (BOOL)matchesNotification:(NSNotification *)aNotification; 29 | 30 | - (BOOL)argument:(id)expectedArg matchesArgument:(id)observedArg; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /Example/Pods/OCMock/Source/OCMock/OCMObserverRecorder.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | #import 19 | #import "NSInvocation+OCMAdditions.h" 20 | #import "OCMObserverRecorder.h" 21 | 22 | @interface NSObject(HCMatcherDummy) 23 | - (BOOL)matches:(id)item; 24 | @end 25 | 26 | #pragma mark - 27 | 28 | 29 | @implementation OCMObserverRecorder 30 | 31 | #pragma mark Initialisers, description, accessors, etc. 32 | 33 | - (void)dealloc 34 | { 35 | [recordedNotification release]; 36 | [super dealloc]; 37 | } 38 | 39 | 40 | #pragma mark Recording 41 | 42 | - (NSNotification *)notificationWithName:(NSString *)name object:(id)sender 43 | { 44 | recordedNotification = [[NSNotification notificationWithName:name object:sender] retain]; 45 | return nil; 46 | } 47 | 48 | - (NSNotification *)notificationWithName:(NSString *)name object:(id)sender userInfo:(NSDictionary *)userInfo 49 | { 50 | recordedNotification = [[NSNotification notificationWithName:name object:sender userInfo:userInfo] retain]; 51 | return nil; 52 | } 53 | 54 | 55 | #pragma mark Verification 56 | 57 | - (BOOL)matchesNotification:(NSNotification *)aNotification 58 | { 59 | return [self argument:[recordedNotification name] matchesArgument:[aNotification name]] && 60 | [self argument:[recordedNotification object] matchesArgument:[aNotification object]] && 61 | [self argument:[recordedNotification userInfo] matchesArgument:[aNotification userInfo]]; 62 | } 63 | 64 | - (BOOL)argument:(id)expectedArg matchesArgument:(id)observedArg 65 | { 66 | if([expectedArg isKindOfClass:[OCMConstraint class]]) 67 | { 68 | return [expectedArg evaluate:observedArg]; 69 | } 70 | else if([expectedArg conformsToProtocol:objc_getProtocol("HCMatcher")]) 71 | { 72 | return [expectedArg matches:observedArg]; 73 | } 74 | else if (expectedArg == observedArg) 75 | { 76 | return YES; 77 | } 78 | else if (expectedArg == nil || observedArg == nil) 79 | { 80 | return NO; 81 | } 82 | else 83 | { 84 | return [expectedArg isEqual:observedArg]; 85 | } 86 | } 87 | 88 | 89 | @end 90 | -------------------------------------------------------------------------------- /Example/Pods/OCMock/Source/OCMock/OCMPassByRefSetter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import "OCMArgAction.h" 18 | 19 | @interface OCMPassByRefSetter : OCMArgAction 20 | { 21 | id value; 22 | } 23 | 24 | - (id)initWithValue:(id)value; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /Example/Pods/OCMock/Source/OCMock/OCMPassByRefSetter.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import "OCMPassByRefSetter.h" 18 | 19 | 20 | @implementation OCMPassByRefSetter 21 | 22 | - (id)initWithValue:(id)aValue 23 | { 24 | if ((self = [super init])) 25 | { 26 | value = [aValue retain]; 27 | } 28 | 29 | return self; 30 | } 31 | 32 | - (void)dealloc 33 | { 34 | [value release]; 35 | [super dealloc]; 36 | } 37 | 38 | - (void)handleArgument:(id)arg 39 | { 40 | void *pointerValue = [arg pointerValue]; 41 | if(pointerValue != NULL) 42 | { 43 | if([value isKindOfClass:[NSValue class]]) 44 | [(NSValue *)value getValue:pointerValue]; 45 | else 46 | *(id *)pointerValue = value; 47 | } 48 | } 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /Example/Pods/OCMock/Source/OCMock/OCMRealObjectForwarder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | 19 | @interface OCMRealObjectForwarder : NSObject 20 | { 21 | } 22 | 23 | - (void)handleInvocation:(NSInvocation *)anInvocation; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /Example/Pods/OCMock/Source/OCMock/OCMRealObjectForwarder.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | #import "OCPartialMockObject.h" 19 | #import "OCMRealObjectForwarder.h" 20 | #import "OCMFunctionsPrivate.h" 21 | 22 | 23 | @implementation OCMRealObjectForwarder 24 | 25 | - (void)handleInvocation:(NSInvocation *)anInvocation 26 | { 27 | id invocationTarget = [anInvocation target]; 28 | 29 | [anInvocation setSelector:OCMAliasForOriginalSelector([anInvocation selector])]; 30 | if ([invocationTarget isProxy]) 31 | { 32 | if (class_getInstanceMethod([invocationTarget mockObjectClass], @selector(realObject))) 33 | { 34 | // the method has been invoked on the mock, we need to change the target to the real object 35 | [anInvocation setTarget:[(OCPartialMockObject *)invocationTarget realObject]]; 36 | } 37 | else 38 | { 39 | [NSException raise:NSInternalInconsistencyException 40 | format:@"Method andForwardToRealObject can only be used with partial mocks and class methods."]; 41 | } 42 | } 43 | 44 | [anInvocation invoke]; 45 | } 46 | 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /Example/Pods/OCMock/Source/OCMock/OCMRecorder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | 19 | @class OCMockObject; 20 | @class OCMInvocationMatcher; 21 | 22 | 23 | @interface OCMRecorder : NSProxy 24 | { 25 | OCMockObject *mockObject; 26 | OCMInvocationMatcher *invocationMatcher; 27 | } 28 | 29 | - (instancetype)init; 30 | - (instancetype)initWithMockObject:(OCMockObject *)aMockObject; 31 | 32 | - (void)setMockObject:(OCMockObject *)aMockObject; 33 | 34 | - (OCMInvocationMatcher *)invocationMatcher; 35 | 36 | - (id)classMethod; 37 | - (id)ignoringNonObjectArgs; 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /Example/Pods/OCMock/Source/OCMock/OCMRecorder.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | #import "OCMRecorder.h" 19 | #import "OCMockObject.h" 20 | #import "OCMInvocationMatcher.h" 21 | #import "OCClassMockObject.h" 22 | 23 | @implementation OCMRecorder 24 | 25 | - (instancetype)init 26 | { 27 | // no super, we're inheriting from NSProxy 28 | return self; 29 | } 30 | 31 | - (instancetype)initWithMockObject:(OCMockObject *)aMockObject 32 | { 33 | [self init]; 34 | [self setMockObject:aMockObject]; 35 | return self; 36 | } 37 | 38 | - (void)setMockObject:(OCMockObject *)aMockObject 39 | { 40 | mockObject = aMockObject; 41 | } 42 | 43 | - (void)dealloc 44 | { 45 | [invocationMatcher release]; 46 | [super dealloc]; 47 | } 48 | 49 | - (NSString *)description 50 | { 51 | return [invocationMatcher description]; 52 | } 53 | 54 | - (OCMInvocationMatcher *)invocationMatcher 55 | { 56 | return invocationMatcher; 57 | } 58 | 59 | 60 | #pragma mark Modifying the matcher 61 | 62 | - (id)classMethod 63 | { 64 | // should we handle the case where this is called with a mock that isn't a class mock? 65 | [invocationMatcher setRecordedAsClassMethod:YES]; 66 | return self; 67 | } 68 | 69 | - (id)ignoringNonObjectArgs 70 | { 71 | [invocationMatcher setIgnoreNonObjectArgs:YES]; 72 | return self; 73 | } 74 | 75 | 76 | #pragma mark Recording the actual invocation 77 | 78 | - (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector 79 | { 80 | if([invocationMatcher recordedAsClassMethod]) 81 | return [[(OCClassMockObject *)mockObject mockedClass] methodSignatureForSelector:aSelector]; 82 | 83 | NSMethodSignature *signature = [mockObject methodSignatureForSelector:aSelector]; 84 | if(signature == nil) 85 | { 86 | // if we're a working with a class mock and there is a class method, auto-switch 87 | if(([object_getClass(mockObject) isSubclassOfClass:[OCClassMockObject class]]) && 88 | ([[(OCClassMockObject *)mockObject mockedClass] respondsToSelector:aSelector])) 89 | { 90 | [self classMethod]; 91 | signature = [self methodSignatureForSelector:aSelector]; 92 | } 93 | } 94 | return signature; 95 | } 96 | 97 | - (void)forwardInvocation:(NSInvocation *)anInvocation 98 | { 99 | [anInvocation setTarget:nil]; 100 | [invocationMatcher setInvocation:anInvocation]; 101 | } 102 | 103 | - (void)doesNotRecognizeSelector:(SEL)aSelector 104 | { 105 | [NSException raise:NSInvalidArgumentException format:@"%@: cannot stub/expect/verify method '%@' because no such method exists in the mocked class.", mockObject, NSStringFromSelector(aSelector)]; 106 | } 107 | 108 | 109 | @end 110 | -------------------------------------------------------------------------------- /Example/Pods/OCMock/Source/OCMock/OCMReturnValueProvider.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | 19 | @interface OCMReturnValueProvider : NSObject 20 | { 21 | id returnValue; 22 | } 23 | 24 | - (instancetype)initWithValue:(id)aValue; 25 | 26 | - (void)handleInvocation:(NSInvocation *)anInvocation; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /Example/Pods/OCMock/Source/OCMock/OCMReturnValueProvider.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import "NSMethodSignature+OCMAdditions.h" 18 | #import "OCMReturnValueProvider.h" 19 | #import "OCMFunctions.h" 20 | 21 | 22 | @implementation OCMReturnValueProvider 23 | 24 | - (instancetype)initWithValue:(id)aValue 25 | { 26 | if ((self = [super init])) 27 | { 28 | returnValue = [aValue retain]; 29 | } 30 | 31 | return self; 32 | } 33 | 34 | - (void)dealloc 35 | { 36 | [returnValue release]; 37 | [super dealloc]; 38 | } 39 | 40 | - (void)handleInvocation:(NSInvocation *)anInvocation 41 | { 42 | if(!OCMIsObjectType([[anInvocation methodSignature] methodReturnType])) 43 | { 44 | @throw [NSException exceptionWithName:NSInvalidArgumentException reason:@"Expected invocation with object return type. Did you mean to use andReturnValue: instead?" userInfo:nil]; 45 | } 46 | NSString *sel = NSStringFromSelector([anInvocation selector]); 47 | if([sel hasPrefix:@"alloc"] || [sel hasPrefix:@"new"] || [sel hasPrefix:@"copy"] || [sel hasPrefix:@"mutableCopy"]) 48 | { 49 | // methods that "create" an object return it with an extra retain count 50 | [returnValue retain]; 51 | } 52 | [anInvocation setReturnValue:&returnValue]; 53 | } 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /Example/Pods/OCMock/Source/OCMock/OCMStubRecorder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | #import 19 | #import 20 | 21 | @interface OCMStubRecorder : OCMRecorder 22 | 23 | - (id)andReturn:(id)anObject; 24 | - (id)andReturnValue:(NSValue *)aValue; 25 | - (id)andThrow:(NSException *)anException; 26 | - (id)andPost:(NSNotification *)aNotification; 27 | - (id)andCall:(SEL)selector onObject:(id)anObject; 28 | - (id)andDo:(void (^)(NSInvocation *invocation))block; 29 | - (id)andForwardToRealObject; 30 | 31 | @end 32 | 33 | 34 | @interface OCMStubRecorder (Properties) 35 | 36 | #define andReturn(aValue) _andReturn(({ \ 37 | __typeof__(aValue) _val = (aValue); \ 38 | NSValue *_nsval = [NSValue value:&_val withObjCType:@encode(__typeof__(_val))]; \ 39 | if (OCMIsObjectType(@encode(__typeof(_val)))) { \ 40 | objc_setAssociatedObject(_nsval, "OCMAssociatedBoxedValue", *(__unsafe_unretained id *) (void *) &_val, OBJC_ASSOCIATION_RETAIN); \ 41 | } \ 42 | _nsval; \ 43 | })) 44 | @property (nonatomic, readonly) OCMStubRecorder *(^ _andReturn)(NSValue *); 45 | 46 | #define andThrow(anException) _andThrow(anException) 47 | @property (nonatomic, readonly) OCMStubRecorder *(^ _andThrow)(NSException *); 48 | 49 | #define andPost(aNotification) _andPost(aNotification) 50 | @property (nonatomic, readonly) OCMStubRecorder *(^ _andPost)(NSNotification *); 51 | 52 | #define andCall(anObject, aSelector) _andCall(anObject, aSelector) 53 | @property (nonatomic, readonly) OCMStubRecorder *(^ _andCall)(id, SEL); 54 | 55 | #define andDo(aBlock) _andDo(aBlock) 56 | @property (nonatomic, readonly) OCMStubRecorder *(^ _andDo)(void (^)(NSInvocation *)); 57 | 58 | #define andForwardToRealObject() _andForwardToRealObject() 59 | @property (nonatomic, readonly) OCMStubRecorder *(^ _andForwardToRealObject)(void); 60 | 61 | @end 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /Example/Pods/OCMock/Source/OCMock/OCMVerifier.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import "OCMRecorder.h" 18 | #import "OCMLocation.h" 19 | 20 | 21 | @interface OCMVerifier : OCMRecorder 22 | 23 | @property(retain) OCMLocation *location; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /Example/Pods/OCMock/Source/OCMock/OCMVerifier.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | #import "OCMVerifier.h" 19 | #import "OCMockObject.h" 20 | #import "OCMLocation.h" 21 | #import "OCMInvocationMatcher.h" 22 | 23 | 24 | @implementation OCMVerifier 25 | 26 | - (id)init 27 | { 28 | if ((self = [super init])) 29 | { 30 | invocationMatcher = [[OCMInvocationMatcher alloc] init]; 31 | } 32 | 33 | return self; 34 | } 35 | 36 | - (void)forwardInvocation:(NSInvocation *)anInvocation 37 | { 38 | [super forwardInvocation:anInvocation]; 39 | [mockObject verifyInvocation:invocationMatcher atLocation:self.location]; 40 | } 41 | 42 | - (void)dealloc 43 | { 44 | [_location release]; 45 | [super dealloc]; 46 | } 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /Example/Pods/OCMock/Source/OCMock/OCMock.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | #import 19 | #import 20 | #import 21 | #import 22 | #import 23 | #import 24 | #import 25 | #import 26 | 27 | 28 | #define OCMClassMock(cls) [OCMockObject niceMockForClass:cls] 29 | 30 | #define OCMStrictClassMock(cls) [OCMockObject mockForClass:cls] 31 | 32 | #define OCMProtocolMock(protocol) [OCMockObject niceMockForProtocol:protocol] 33 | 34 | #define OCMStrictProtocolMock(protocol) [OCMockObject mockForProtocol:protocol] 35 | 36 | #define OCMPartialMock(obj) [OCMockObject partialMockForObject:obj] 37 | 38 | #define OCMObserverMock() [OCMockObject observerMock] 39 | 40 | 41 | #define OCMStub(invocation) \ 42 | ({ \ 43 | _OCMSilenceWarnings( \ 44 | [OCMMacroState beginStubMacro]; \ 45 | OCMStubRecorder *recorder = nil; \ 46 | @try{ \ 47 | invocation; \ 48 | }@finally{ \ 49 | recorder = [OCMMacroState endStubMacro]; \ 50 | } \ 51 | recorder; \ 52 | ); \ 53 | }) 54 | 55 | #define OCMExpect(invocation) \ 56 | ({ \ 57 | _OCMSilenceWarnings( \ 58 | [OCMMacroState beginExpectMacro]; \ 59 | OCMStubRecorder *recorder = nil; \ 60 | @try{ \ 61 | invocation; \ 62 | }@finally{ \ 63 | recorder = [OCMMacroState endExpectMacro]; \ 64 | } \ 65 | recorder; \ 66 | ); \ 67 | }) 68 | 69 | #define OCMReject(invocation) \ 70 | ({ \ 71 | _OCMSilenceWarnings( \ 72 | [OCMMacroState beginRejectMacro]; \ 73 | OCMStubRecorder *recorder = nil; \ 74 | @try{ \ 75 | invocation; \ 76 | }@finally{ \ 77 | recorder = [OCMMacroState endRejectMacro]; \ 78 | } \ 79 | recorder; \ 80 | ); \ 81 | }) 82 | 83 | #define ClassMethod(invocation) \ 84 | _OCMSilenceWarnings( \ 85 | [[OCMMacroState globalState] switchToClassMethod]; \ 86 | invocation; \ 87 | ); 88 | 89 | 90 | #define OCMVerifyAll(mock) [mock verifyAtLocation:OCMMakeLocation(self, __FILE__, __LINE__)] 91 | 92 | #define OCMVerifyAllWithDelay(mock, delay) [mock verifyWithDelay:delay atLocation:OCMMakeLocation(self, __FILE__, __LINE__)] 93 | 94 | #define OCMVerify(invocation) \ 95 | ({ \ 96 | _OCMSilenceWarnings( \ 97 | [OCMMacroState beginVerifyMacroAtLocation:OCMMakeLocation(self, __FILE__, __LINE__)]; \ 98 | @try{ \ 99 | invocation; \ 100 | }@finally{ \ 101 | [OCMMacroState endVerifyMacro]; \ 102 | } \ 103 | ); \ 104 | }) 105 | 106 | #define _OCMSilenceWarnings(macro) \ 107 | ({ \ 108 | _Pragma("clang diagnostic push") \ 109 | _Pragma("clang diagnostic ignored \"-Wunused-value\"") \ 110 | _Pragma("clang diagnostic ignored \"-Wunused-getter-return-value\"") \ 111 | macro \ 112 | _Pragma("clang diagnostic pop") \ 113 | }) 114 | -------------------------------------------------------------------------------- /Example/Pods/OCMock/Source/OCMock/OCMockObject.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | 19 | @class OCMLocation; 20 | @class OCMInvocationStub; 21 | @class OCMStubRecorder; 22 | @class OCMInvocationMatcher; 23 | @class OCMInvocationExpectation; 24 | 25 | 26 | @interface OCMockObject : NSProxy 27 | { 28 | BOOL isNice; 29 | BOOL expectationOrderMatters; 30 | NSMutableArray *stubs; 31 | NSMutableArray *expectations; 32 | NSMutableArray *exceptions; 33 | NSMutableArray *invocations; 34 | } 35 | 36 | + (id)mockForClass:(Class)aClass; 37 | + (id)mockForProtocol:(Protocol *)aProtocol; 38 | + (id)partialMockForObject:(NSObject *)anObject; 39 | 40 | + (id)niceMockForClass:(Class)aClass; 41 | + (id)niceMockForProtocol:(Protocol *)aProtocol; 42 | 43 | + (id)observerMock; 44 | 45 | - (instancetype)init; 46 | 47 | - (void)setExpectationOrderMatters:(BOOL)flag; 48 | 49 | - (id)stub; 50 | - (id)expect; 51 | - (id)reject; 52 | 53 | - (id)verify; 54 | - (id)verifyAtLocation:(OCMLocation *)location; 55 | 56 | - (void)verifyWithDelay:(NSTimeInterval)delay; 57 | - (void)verifyWithDelay:(NSTimeInterval)delay atLocation:(OCMLocation *)location; 58 | 59 | - (void)stopMocking; 60 | 61 | // internal use only 62 | 63 | - (void)addStub:(OCMInvocationStub *)aStub; 64 | - (void)addExpectation:(OCMInvocationExpectation *)anExpectation; 65 | 66 | - (BOOL)handleInvocation:(NSInvocation *)anInvocation; 67 | - (void)handleUnRecordedInvocation:(NSInvocation *)anInvocation; 68 | - (BOOL)handleSelector:(SEL)sel; 69 | 70 | - (void)verifyInvocation:(OCMInvocationMatcher *)matcher; 71 | - (void)verifyInvocation:(OCMInvocationMatcher *)matcher atLocation:(OCMLocation *)location; 72 | 73 | @end 74 | 75 | -------------------------------------------------------------------------------- /Example/Pods/OCMock/Source/OCMock/OCObserverMockObject.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | 19 | @class OCMLocation; 20 | 21 | 22 | @interface OCObserverMockObject : NSObject 23 | { 24 | BOOL expectationOrderMatters; 25 | NSMutableArray *recorders; 26 | NSMutableArray *centers; 27 | } 28 | 29 | - (void)setExpectationOrderMatters:(BOOL)flag; 30 | 31 | - (id)expect; 32 | 33 | - (void)verify; 34 | - (void)verifyAtLocation:(OCMLocation *)location; 35 | 36 | - (void)handleNotification:(NSNotification *)aNotification; 37 | 38 | // internal use 39 | 40 | - (void)autoRemoveFromCenter:(NSNotificationCenter *)aCenter; 41 | - (NSNotification *)notificationWithName:(NSString *)name object:(id)sender; 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /Example/Pods/OCMock/Source/OCMock/OCPartialMockObject.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import "OCClassMockObject.h" 18 | 19 | @interface OCPartialMockObject : OCClassMockObject 20 | { 21 | NSObject *realObject; 22 | } 23 | 24 | - (id)initWithObject:(NSObject *)anObject; 25 | 26 | - (NSObject *)realObject; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /Example/Pods/OCMock/Source/OCMock/OCProtocolMockObject.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2005-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | 19 | @interface OCProtocolMockObject : OCMockObject 20 | { 21 | Protocol *mockedProtocol; 22 | } 23 | 24 | - (id)initWithProtocol:(Protocol *)aProtocol; 25 | 26 | @end 27 | 28 | -------------------------------------------------------------------------------- /Example/Pods/OCMock/Source/OCMock/OCProtocolMockObject.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2005-2016 Erik Doernenburg and contributors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | * not use these files except in compliance with the License. You may obtain 6 | * a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #import 18 | #import "NSMethodSignature+OCMAdditions.h" 19 | #import "OCProtocolMockObject.h" 20 | 21 | @implementation OCProtocolMockObject 22 | 23 | #pragma mark Initialisers, description, accessors, etc. 24 | 25 | - (id)initWithProtocol:(Protocol *)aProtocol 26 | { 27 | NSParameterAssert(aProtocol != nil); 28 | [super init]; 29 | mockedProtocol = aProtocol; 30 | return self; 31 | } 32 | 33 | - (NSString *)description 34 | { 35 | const char* name = protocol_getName(mockedProtocol); 36 | return [NSString stringWithFormat:@"OCMockObject(%s)", name]; 37 | } 38 | 39 | #pragma mark Proxy API 40 | 41 | - (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector 42 | { 43 | struct { BOOL isRequired; BOOL isInstance; } opts[4] = { {YES, YES}, {NO, YES}, {YES, NO}, {NO, NO} }; 44 | for(int i = 0; i < 4; i++) 45 | { 46 | struct objc_method_description methodDescription = protocol_getMethodDescription(mockedProtocol, aSelector, opts[i].isRequired, opts[i].isInstance); 47 | if(methodDescription.name != NULL) 48 | return [NSMethodSignature signatureWithObjCTypes:methodDescription.types]; 49 | } 50 | return nil; 51 | } 52 | 53 | - (BOOL)conformsToProtocol:(Protocol *)aProtocol 54 | { 55 | return protocol_conformsToProtocol(mockedProtocol, aProtocol); 56 | } 57 | 58 | - (BOOL)respondsToSelector:(SEL)selector 59 | { 60 | return ([self methodSignatureForSelector:selector] != nil); 61 | } 62 | 63 | @end 64 | -------------------------------------------------------------------------------- /Example/Pods/Pods.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/OCMock/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 3.4.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/OCMock/OCMock-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_OCMock : NSObject 3 | @end 4 | @implementation PodsDummy_OCMock 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/OCMock/OCMock-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/OCMock/OCMock-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | #import "OCMock.h" 14 | #import "OCMockObject.h" 15 | #import "OCMArg.h" 16 | #import "OCMConstraint.h" 17 | #import "OCMLocation.h" 18 | #import "OCMMacroState.h" 19 | #import "OCMRecorder.h" 20 | #import "OCMStubRecorder.h" 21 | #import "NSNotificationCenter+OCMAdditions.h" 22 | #import "OCMFunctions.h" 23 | 24 | FOUNDATION_EXPORT double OCMockVersionNumber; 25 | FOUNDATION_EXPORT const unsigned char OCMockVersionString[]; 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/OCMock/OCMock.modulemap: -------------------------------------------------------------------------------- 1 | framework module OCMock { 2 | umbrella header "OCMock-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/OCMock/OCMock.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/OCMock 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Public" 4 | PODS_BUILD_DIR = $BUILD_DIR 5 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 6 | PODS_ROOT = ${SRCROOT} 7 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/OCMock 8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 9 | SKIP_INSTALL = YES 10 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-VeeContactPicker_Example/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-VeeContactPicker_Example/Pods-VeeContactPicker_Example-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## UIImageView-AGCInitials 5 | 6 | Copyright (c) 2016 Andrea Cipriani 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy 9 | of this software and associated documentation files (the "Software"), to deal 10 | in the Software without restriction, including without limitation the rights 11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | copies of the Software, and to permit persons to whom the Software is 13 | furnished to do so, subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be included in 16 | all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | THE SOFTWARE. 25 | 26 | 27 | ## VeeContactPicker 28 | 29 | Copyright (c) 2016 Code Atlas SRL 30 | 31 | Permission is hereby granted, free of charge, to any person obtaining a copy 32 | of this software and associated documentation files (the "Software"), to deal 33 | in the Software without restriction, including without limitation the rights 34 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 35 | copies of the Software, and to permit persons to whom the Software is 36 | furnished to do so, subject to the following conditions: 37 | 38 | The above copyright notice and this permission notice shall be included in 39 | all copies or substantial portions of the Software. 40 | 41 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 42 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 43 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 44 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 45 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 46 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 47 | THE SOFTWARE. 48 | 49 | Generated by CocoaPods - https://cocoapods.org 50 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-VeeContactPicker_Example/Pods-VeeContactPicker_Example-acknowledgements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreferenceSpecifiers 6 | 7 | 8 | FooterText 9 | This application makes use of the following third party libraries: 10 | Title 11 | Acknowledgements 12 | Type 13 | PSGroupSpecifier 14 | 15 | 16 | FooterText 17 | Copyright (c) 2016 Andrea Cipriani <andrea.g.cipriani@gmail.com> 18 | 19 | Permission is hereby granted, free of charge, to any person obtaining a copy 20 | of this software and associated documentation files (the "Software"), to deal 21 | in the Software without restriction, including without limitation the rights 22 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 23 | copies of the Software, and to permit persons to whom the Software is 24 | furnished to do so, subject to the following conditions: 25 | 26 | The above copyright notice and this permission notice shall be included in 27 | all copies or substantial portions of the Software. 28 | 29 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 30 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 31 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 32 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 33 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 34 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 35 | THE SOFTWARE. 36 | 37 | License 38 | MIT 39 | Title 40 | UIImageView-AGCInitials 41 | Type 42 | PSGroupSpecifier 43 | 44 | 45 | FooterText 46 | Copyright (c) 2016 Code Atlas SRL <info@codeatlas.it> 47 | 48 | Permission is hereby granted, free of charge, to any person obtaining a copy 49 | of this software and associated documentation files (the "Software"), to deal 50 | in the Software without restriction, including without limitation the rights 51 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 52 | copies of the Software, and to permit persons to whom the Software is 53 | furnished to do so, subject to the following conditions: 54 | 55 | The above copyright notice and this permission notice shall be included in 56 | all copies or substantial portions of the Software. 57 | 58 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 59 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 60 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 61 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 62 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 63 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 64 | THE SOFTWARE. 65 | 66 | License 67 | MIT 68 | Title 69 | VeeContactPicker 70 | Type 71 | PSGroupSpecifier 72 | 73 | 74 | FooterText 75 | Generated by CocoaPods - https://cocoapods.org 76 | Title 77 | 78 | Type 79 | PSGroupSpecifier 80 | 81 | 82 | StringsTable 83 | Acknowledgements 84 | Title 85 | Acknowledgements 86 | 87 | 88 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-VeeContactPicker_Example/Pods-VeeContactPicker_Example-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_VeeContactPicker_Example : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_VeeContactPicker_Example 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-VeeContactPicker_Example/Pods-VeeContactPicker_Example-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | 14 | FOUNDATION_EXPORT double Pods_VeeContactPicker_ExampleVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char Pods_VeeContactPicker_ExampleVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-VeeContactPicker_Example/Pods-VeeContactPicker_Example.debug.xcconfig: -------------------------------------------------------------------------------- 1 | FRAMEWORK_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/UIImageView-AGCInitials" "$PODS_CONFIGURATION_BUILD_DIR/VeeContactPicker" 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 4 | OTHER_CFLAGS = $(inherited) -iquote "$PODS_CONFIGURATION_BUILD_DIR/UIImageView-AGCInitials/UIImageView_AGCInitials.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/VeeContactPicker/VeeContactPicker.framework/Headers" 5 | OTHER_LDFLAGS = $(inherited) -framework "UIImageView_AGCInitials" -framework "VeeContactPicker" 6 | PODS_BUILD_DIR = $BUILD_DIR 7 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 9 | PODS_ROOT = ${SRCROOT}/Pods 10 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-VeeContactPicker_Example/Pods-VeeContactPicker_Example.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_VeeContactPicker_Example { 2 | umbrella header "Pods-VeeContactPicker_Example-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-VeeContactPicker_Example/Pods-VeeContactPicker_Example.release.xcconfig: -------------------------------------------------------------------------------- 1 | FRAMEWORK_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/UIImageView-AGCInitials" "$PODS_CONFIGURATION_BUILD_DIR/VeeContactPicker" 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 4 | OTHER_CFLAGS = $(inherited) -iquote "$PODS_CONFIGURATION_BUILD_DIR/UIImageView-AGCInitials/UIImageView_AGCInitials.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/VeeContactPicker/VeeContactPicker.framework/Headers" 5 | OTHER_LDFLAGS = $(inherited) -framework "UIImageView_AGCInitials" -framework "VeeContactPicker" 6 | PODS_BUILD_DIR = $BUILD_DIR 7 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 9 | PODS_ROOT = ${SRCROOT}/Pods 10 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-VeeContactPicker_Tests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-VeeContactPicker_Tests/Pods-VeeContactPicker_Tests-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_VeeContactPicker_Tests : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_VeeContactPicker_Tests 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-VeeContactPicker_Tests/Pods-VeeContactPicker_Tests-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | 14 | FOUNDATION_EXPORT double Pods_VeeContactPicker_TestsVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char Pods_VeeContactPicker_TestsVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-VeeContactPicker_Tests/Pods-VeeContactPicker_Tests.debug.xcconfig: -------------------------------------------------------------------------------- 1 | FRAMEWORK_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/OCMock" "$PODS_CONFIGURATION_BUILD_DIR/UIImageView-AGCInitials" "$PODS_CONFIGURATION_BUILD_DIR/VeeContactPicker" 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 4 | OTHER_CFLAGS = $(inherited) -iquote "$PODS_CONFIGURATION_BUILD_DIR/OCMock/OCMock.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/UIImageView-AGCInitials/UIImageView_AGCInitials.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/VeeContactPicker/VeeContactPicker.framework/Headers" 5 | OTHER_LDFLAGS = $(inherited) -framework "OCMock" -framework "UIImageView_AGCInitials" -framework "VeeContactPicker" 6 | PODS_BUILD_DIR = $BUILD_DIR 7 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 9 | PODS_ROOT = ${SRCROOT}/Pods 10 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-VeeContactPicker_Tests/Pods-VeeContactPicker_Tests.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_VeeContactPicker_Tests { 2 | umbrella header "Pods-VeeContactPicker_Tests-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-VeeContactPicker_Tests/Pods-VeeContactPicker_Tests.release.xcconfig: -------------------------------------------------------------------------------- 1 | FRAMEWORK_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/OCMock" "$PODS_CONFIGURATION_BUILD_DIR/UIImageView-AGCInitials" "$PODS_CONFIGURATION_BUILD_DIR/VeeContactPicker" 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 4 | OTHER_CFLAGS = $(inherited) -iquote "$PODS_CONFIGURATION_BUILD_DIR/OCMock/OCMock.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/UIImageView-AGCInitials/UIImageView_AGCInitials.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/VeeContactPicker/VeeContactPicker.framework/Headers" 5 | OTHER_LDFLAGS = $(inherited) -framework "OCMock" -framework "UIImageView_AGCInitials" -framework "VeeContactPicker" 6 | PODS_BUILD_DIR = $BUILD_DIR 7 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 9 | PODS_ROOT = ${SRCROOT}/Pods 10 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/UIImageView-AGCInitials/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 0.0.2 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/UIImageView-AGCInitials/UIImageView-AGCInitials-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_UIImageView_AGCInitials : NSObject 3 | @end 4 | @implementation PodsDummy_UIImageView_AGCInitials 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/UIImageView-AGCInitials/UIImageView-AGCInitials-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/UIImageView-AGCInitials/UIImageView-AGCInitials-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | #import "AGCInitialsColors.h" 14 | #import "UIImageView+AGCInitials.h" 15 | 16 | FOUNDATION_EXPORT double UIImageView_AGCInitialsVersionNumber; 17 | FOUNDATION_EXPORT const unsigned char UIImageView_AGCInitialsVersionString[]; 18 | 19 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/UIImageView-AGCInitials/UIImageView-AGCInitials.modulemap: -------------------------------------------------------------------------------- 1 | framework module UIImageView_AGCInitials { 2 | umbrella header "UIImageView-AGCInitials-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/UIImageView-AGCInitials/UIImageView-AGCInitials.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/UIImageView-AGCInitials 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Public" 4 | PODS_BUILD_DIR = $BUILD_DIR 5 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 6 | PODS_ROOT = ${SRCROOT} 7 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/UIImageView-AGCInitials 8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 9 | SKIP_INSTALL = YES 10 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/VeeContactPicker/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | ${PRODUCT_BUNDLE_IDENTIFIER} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 0.1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/VeeContactPicker/ResourceBundle-VeeContactPicker-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleIdentifier 8 | ${PRODUCT_BUNDLE_IDENTIFIER} 9 | CFBundleInfoDictionaryVersion 10 | 6.0 11 | CFBundleName 12 | ${PRODUCT_NAME} 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 0.1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | NSPrincipalClass 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/VeeContactPicker/VeeContactPicker-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_VeeContactPicker : NSObject 3 | @end 4 | @implementation PodsDummy_VeeContactPicker 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/VeeContactPicker/VeeContactPicker-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/VeeContactPicker/VeeContactPicker-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | #import "VeeABDelegate.h" 14 | #import "VeeABRecordsImporter.h" 15 | #import "VeeAddressBook.h" 16 | #import "VeeContactCellConfiguration.h" 17 | #import "VeeContactPickerDelegate.h" 18 | #import "VeeContactPickerViewController.h" 19 | #import "VeeSectionedArrayDataSource.h" 20 | #import "VeeContactPickerAppearanceConstants.h" 21 | #import "VeeContactPickerOptions.h" 22 | #import "VeeContactPickerStrings.h" 23 | #import "VeeABRecord.h" 24 | #import "VeeContactFactory.h" 25 | #import "VeeContactFactoryProt.h" 26 | #import "VeeContactProtFactoryProducer.h" 27 | #import "VeeContact.h" 28 | #import "VeeContactProt.h" 29 | #import "VeePostalAddress.h" 30 | #import "VeePostalAddressProt.h" 31 | #import "VeeSectionable.h" 32 | #import "NSObject+VeeCommons.h" 33 | #import "UILabel+VeeBoldify.h" 34 | #import "VeeCommons.h" 35 | 36 | FOUNDATION_EXPORT double VeeContactPickerVersionNumber; 37 | FOUNDATION_EXPORT const unsigned char VeeContactPickerVersionString[]; 38 | 39 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/VeeContactPicker/VeeContactPicker.modulemap: -------------------------------------------------------------------------------- 1 | framework module VeeContactPicker { 2 | umbrella header "VeeContactPicker-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/VeeContactPicker/VeeContactPicker.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/VeeContactPicker 2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/UIImageView-AGCInitials" 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Public" 5 | OTHER_LDFLAGS = -framework "AddressBook" -framework "UIKit" 6 | PODS_BUILD_DIR = $BUILD_DIR 7 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_ROOT = ${SRCROOT} 9 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/../.. 10 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 11 | SKIP_INSTALL = YES 12 | -------------------------------------------------------------------------------- /Example/Pods/UIImageView-AGCInitials/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016 Andrea Cipriani 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /Example/Pods/UIImageView-AGCInitials/Pod/Classes/AGCInitialsColors.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Andrea Cipriani on 07/04/16. 3 | // 4 | // 5 | 6 | #import 7 | @import UIKit; 8 | 9 | @interface AGCInitialsColors : NSObject 10 | 11 | + (id _Nonnull)sharedInstance; 12 | 13 | @property (nonatomic, nonnull, strong) NSArray* colorPalette; 14 | - (UIColor* _Nonnull)colorForString:(NSString* _Nullable)string; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Example/Pods/UIImageView-AGCInitials/Pod/Classes/AGCInitialsColors.m: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Andrea Cipriani on 07/04/16. 3 | // 4 | // 5 | 6 | #import "AGCInitialsColors.h" 7 | 8 | #define UIColorFromRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16)) / 255.0 green:((float)((rgbValue & 0xFF00) >> 8)) / 255.0 blue:((float)(rgbValue & 0xFF)) / 255.0 alpha:1.0] 9 | 10 | @interface AGCInitialsColors () 11 | 12 | @property (nonatomic, strong) NSMutableDictionary* cachedColorsForStrings; 13 | 14 | @end 15 | 16 | @implementation AGCInitialsColors 17 | 18 | + (id _Nonnull)sharedInstance 19 | { 20 | static AGCInitialsColors* sharedInstance = nil; 21 | static dispatch_once_t onceToken; 22 | dispatch_once(&onceToken, ^{ 23 | sharedInstance = [[self alloc] initWithDefaultColorPalette]; 24 | }); 25 | return sharedInstance; 26 | } 27 | 28 | - (instancetype)initWithDefaultColorPalette 29 | { 30 | self = [super init]; 31 | if (!self) { 32 | return nil; 33 | } 34 | _colorPalette = [self defaultColorPalette]; 35 | _cachedColorsForStrings = [NSMutableDictionary new]; 36 | return self; 37 | } 38 | 39 | - (NSArray*)defaultColorPalette 40 | { 41 | return @[ UIColorFromRGB(0x6200EA), UIColorFromRGB(0xC51162), UIColorFromRGB(0x304FFE), UIColorFromRGB(0x2962FF), UIColorFromRGB(0x00BFA5), UIColorFromRGB(0xd50000), UIColorFromRGB(0x00C853), UIColorFromRGB(0x64DD17), UIColorFromRGB(0x00B8D4), UIColorFromRGB(0x827717), UIColorFromRGB(0xFFD600), UIColorFromRGB(0xDD2C00), UIColorFromRGB(0x37474F), UIColorFromRGB(0xBF360C), UIColorFromRGB(0x004D40), UIColorFromRGB(0xe53935), UIColorFromRGB(0x0091EA), UIColorFromRGB(0x607D8B), UIColorFromRGB(0xFF5722), UIColorFromRGB(0xFF9800), UIColorFromRGB(0xFFC107), UIColorFromRGB(0x8BC34A), UIColorFromRGB(0x4CAF50), UIColorFromRGB(0x009688), UIColorFromRGB(0x00BCD4), UIColorFromRGB(0x42A5F5), UIColorFromRGB(0x5C6BC0), UIColorFromRGB(0x673AB7), UIColorFromRGB(0xE91E63), UIColorFromRGB(0xf44336) ]; 42 | } 43 | 44 | - (void)setPalette:(NSArray*)colorPalette 45 | { 46 | _colorPalette = colorPalette; 47 | } 48 | 49 | - (UIColor* _Nonnull)colorForString:(NSString*)string 50 | { 51 | if (string == nil) { 52 | string = @""; 53 | } 54 | if ([self cachedColorForString:string]) { 55 | return [self cachedColorForString:string]; 56 | } 57 | 58 | unsigned long hashNumber = agc_djb2StringToLong((unsigned char*)[string UTF8String]); 59 | UIColor* color = _colorPalette[hashNumber % [_colorPalette count]]; 60 | _cachedColorsForStrings[string] = color; 61 | return color; 62 | } 63 | 64 | - (UIColor*)cachedColorForString:(NSString*)string 65 | { 66 | return _cachedColorsForStrings[string]; 67 | } 68 | 69 | /* 70 | http://www.cse.yorku.ca/~oz/hash.html djb2 algorithm to generate an unsigned long hash from a given string. 71 | Attention, it could return different values on different architectures for the same string 72 | */ 73 | 74 | unsigned long agc_djb2StringToLong(unsigned char* str) 75 | { 76 | unsigned long hash = 5381; 77 | int c; 78 | while ((c = *str++)) { 79 | hash = ((hash << 5) + hash) + c; 80 | } 81 | return hash; 82 | } 83 | 84 | @end 85 | -------------------------------------------------------------------------------- /Example/Pods/UIImageView-AGCInitials/Pod/Classes/UIImageView+AGCInitials.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Andrea Cipriani on 07/04/16. 3 | // 4 | // 5 | 6 | #import 7 | 8 | @class AGCInitialsColors; 9 | 10 | @interface UIImageView (AGCInitials) 11 | 12 | - (void)agc_setImageWithInitials:(nonnull NSString*)initials; 13 | - (void)agc_setImageWithInitials:(nonnull NSString*)initials andTextAttributes:(nonnull NSDictionary*)textAttributes; 14 | - (void)agc_setImageWithInitialsFromName:(nonnull NSString*)name; 15 | - (void)agc_setImageWithInitialsFromName:(nonnull NSString*)name separatedByString:(nonnull NSString*)separator; 16 | - (void)agc_setImageWithInitialsFromName:(nonnull NSString*)name withTextAttributes:(nonnull NSDictionary*)textAttributes; 17 | - (void)agc_setImageWithInitialsFromName:(nonnull NSString*)name separatedByString:(nonnull NSString*)separator withTextAttributes:(nonnull NSDictionary*)textAttributes; 18 | - (void)agc_setImageWithInitials:(nonnull NSString*)initials stringToGenerateColor:(nonnull NSString*)stringToGenerateColor textAttributes:(nonnull NSDictionary*)textAttributes; //Designated initializer 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /Example/Tests/Controller/Address Book/VeeABRecordsImporterTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Andrea Cipriani on 23/03/16. 3 | // Copyright © 2016 Code Atlas SRL. All rights reserved. 4 | // 5 | 6 | #import 7 | #import "VeeABRecordsImporter.h" 8 | @import AddressBook; 9 | 10 | @interface VeeABRecordsImporterTests : XCTestCase 11 | 12 | @property (nonatomic) ABAddressBookRef addressBook; 13 | @property (nonatomic,assign) NSUInteger numberOfRecordsInAddressBook; 14 | 15 | @end 16 | 17 | @implementation VeeABRecordsImporterTests 18 | 19 | #pragma mark - Methods setup 20 | 21 | -(void)setUp 22 | { 23 | //TODO: green local, red on travis - NSAssert(ABAddressBookGetAuthorizationStatus() == kABAuthorizationStatusAuthorized, @"ABAddressBookGetAuthorizationStatus is not authorized!"); 24 | CFErrorRef* cfError = nil; 25 | _addressBook = ABAddressBookCreateWithOptions(NULL, cfError); 26 | if (cfError) { 27 | NSLog(@"Error while creating address book"); 28 | } 29 | _numberOfRecordsInAddressBook = [self numberOfRecordsInAddressBook:_addressBook]; 30 | } 31 | 32 | - (void)testNumberOfImportedRecords 33 | { 34 | //VeeABRecordsImporter* veeABRecordsImporter = [VeeABRecordsImporter new]; 35 | //NSUInteger numberOfImportedRecords = [[veeABRecordsImporter importVeeABRecordsFromAddressBook:_addressBook] count]; 36 | //BOOL isNumberOfImportedRecordsCorrect = _numberOfRecordsInAddressBook == numberOfImportedRecords; 37 | //TODO: green local, red on travis - NSAssert(isNumberOfImportedRecordsCorrect, @"Number of imported records is %zd but should be %zd",numberOfImportedRecords,_numberOfRecordsInAddressBook); 38 | } 39 | 40 | #pragma mark - Private utils 41 | 42 | -(NSUInteger)numberOfRecordsInAddressBook:(ABAddressBookRef)addressBook 43 | { 44 | NSUInteger numberOfContactsInAddressBook = 0; 45 | NSArray* allSources = (__bridge_transfer NSArray*)(ABAddressBookCopyArrayOfAllSources(addressBook)); 46 | for (int s = 0; s < allSources.count; s++) { 47 | ABRecordRef source = (__bridge ABRecordRef)(allSources[s]); 48 | NSArray* peopleInSource = (__bridge NSArray*)ABAddressBookCopyArrayOfAllPeopleInSource(addressBook, source); 49 | for (int p = 0; p < peopleInSource.count; p++) { 50 | numberOfContactsInAddressBook++; 51 | } 52 | } 53 | return numberOfContactsInAddressBook; 54 | } 55 | 56 | @end 57 | -------------------------------------------------------------------------------- /Example/Tests/Model/ContactPicker/VeeContactPickerOptionsTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Andrea Cipriani on 16/03/16. 3 | // Copyright © 2016 Code Atlas SRL. All rights reserved. 4 | // 5 | 6 | #import 7 | #import "VeeContactPickerOptions.h" 8 | #import "VeeContactPickerStrings.h" 9 | 10 | @interface VeeContactPickerOptionsTests : XCTestCase 11 | 12 | @property (nonatomic,strong) VeeContactPickerOptions* veeContactPickerDefaultOptions; 13 | @end 14 | 15 | @implementation VeeContactPickerOptionsTests 16 | 17 | - (void)setUp 18 | { 19 | [super setUp]; 20 | _veeContactPickerDefaultOptions = [VeeContactPickerOptions defaultOptions]; 21 | } 22 | 23 | - (void)tearDown 24 | { 25 | [super tearDown]; 26 | } 27 | 28 | #pragma mark - Init 29 | 30 | -(void)testInitShouldReturnDefaultOptions 31 | { 32 | VeeContactPickerOptions* veeContactPickerOptions = [VeeContactPickerOptions new]; 33 | BOOL areDefaultOption = [veeContactPickerOptions isEqual:veeContactPickerOptions]; 34 | NSAssert(areDefaultOption, @"Init should return default options"); 35 | } 36 | 37 | #pragma mark - Default options 38 | 39 | -(void)testDefaultOptionsStrings 40 | { 41 | BOOL stringsAreDefault = [_veeContactPickerDefaultOptions.veeContactPickerStrings.navigationBarTitle isEqualToString:[VeeContactPickerStrings defaultStrings].navigationBarTitle]; 42 | NSAssert(stringsAreDefault, @"Strings should be default"); 43 | } 44 | 45 | -(void)testDefaultOptionsSectionIdentifiers 46 | { 47 | NSArray* sectionIndexTitles = [UILocalizedIndexedCollation currentCollation].sectionIndexTitles; 48 | NSAssert(sectionIndexTitles, @"SectionIndexTitles should not be nil"); 49 | 50 | BOOL areDefaultSectionIdentifiersCorrect =[_veeContactPickerDefaultOptions.sectionIdentifiers isEqual:sectionIndexTitles]; 51 | NSAssert(areDefaultSectionIdentifiersCorrect, @"Default sectionIdentifiers are %@ but they should be %@",_veeContactPickerDefaultOptions.sectionIdentifiers,sectionIndexTitles); 52 | } 53 | 54 | -(void)testDefaultOptionsSectionIdentifierWildcard 55 | { 56 | BOOL isDefaultSectionIdentifierWildcardCorrect = [_veeContactPickerDefaultOptions.sectionIdentifierWildcard isEqualToString:@"#"]; 57 | NSAssert(isDefaultSectionIdentifierWildcardCorrect, @"Default sectionIdentifierWildcard is %@ but should be #",_veeContactPickerDefaultOptions.sectionIdentifierWildcard); 58 | } 59 | 60 | -(void)testDefaultOptionsShowInitialsIsYES 61 | { 62 | NSAssert(_veeContactPickerDefaultOptions.showInitialsPlaceholder, @"Default options showInitialsPlaceholder should be YES"); 63 | } 64 | 65 | -(void)testDefaultOptionsContactThumbnailImagePlaceholderIsNil 66 | { 67 | NSAssert(_veeContactPickerDefaultOptions.contactThumbnailImagePlaceholder == nil, @"Default options testDefaultOptionsContactThumbnailImagePlaceholderIsNil should be nil"); 68 | } 69 | 70 | @end 71 | -------------------------------------------------------------------------------- /Example/Tests/Model/ContactPicker/VeeContactPickerStringsTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Andrea Cipriani on 16/03/16. 3 | // Copyright © 2016 Code Atlas SRL. All rights reserved. 4 | // 5 | 6 | #import "VeeContactPickerStrings.h" 7 | #import 8 | 9 | @interface VeeContactPickerStringsTests : XCTestCase 10 | 11 | @property (nonatomic, strong) VeeContactPickerStrings* veeContactPickerDefaultStrings; 12 | 13 | @end 14 | 15 | @implementation VeeContactPickerStringsTests 16 | 17 | - (void)setUp 18 | { 19 | [super setUp]; 20 | _veeContactPickerDefaultStrings = [[VeeContactPickerStrings alloc] initWithDefaultStrings]; 21 | } 22 | 23 | - (void)tearDown 24 | { 25 | [super tearDown]; 26 | } 27 | 28 | - (void)testDefaultNavigationBarTitleShouldNotBeNil 29 | { 30 | NSAssert([_veeContactPickerDefaultStrings navigationBarTitle], @"NavigationBarTitle should not be nil"); 31 | } 32 | 33 | - (void)testDefaultCancelButtonShouldNotBeNil 34 | { 35 | NSAssert([_veeContactPickerDefaultStrings cancelButtonTitle], @"CancelButtonTitle should not be nil"); 36 | } 37 | 38 | - (void)testDefaultEmptyViewTextShouldNotBeNil 39 | { 40 | NSAssert([_veeContactPickerDefaultStrings emptyViewLabelText], @"EmptyViewLabelText should not be nil"); 41 | } 42 | 43 | -(void)testCustomStringsAreSet 44 | { 45 | NSString* navigationBarTitle = @"foo"; 46 | NSString* cancelButtonTitle = @"bar"; 47 | NSString* emptyViewTitle = @"lol"; 48 | 49 | VeeContactPickerStrings* veeContactPickerCustomStrings = [[VeeContactPickerStrings alloc] initWithNavigationBarTitle:navigationBarTitle cancelButtonTitle:cancelButtonTitle emptyViewLabelText:emptyViewTitle]; 50 | BOOL isNavigationBarTitleCorrect = [veeContactPickerCustomStrings.navigationBarTitle isEqualToString:navigationBarTitle]; 51 | BOOL isCancelButtonTitleCorrect = [veeContactPickerCustomStrings.cancelButtonTitle isEqualToString:cancelButtonTitle]; 52 | BOOL isEmptyViewTitleCorrect = [veeContactPickerCustomStrings.emptyViewLabelText isEqualToString:emptyViewTitle]; 53 | 54 | NSAssert(isNavigationBarTitleCorrect && isCancelButtonTitleCorrect && isEmptyViewTitleCorrect, @"Custom strings are not set properly"); 55 | } 56 | 57 | @end 58 | -------------------------------------------------------------------------------- /Example/Tests/Model/VeePostalAddressTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Andrea Cipriani on 30/03/16. 3 | // Copyright © 2016 Code Atlas SRL. All rights reserved. 4 | // 5 | 6 | #import "VeePostalAddress.h" 7 | #import 8 | 9 | @interface VeePostalAddressTests : XCTestCase 10 | 11 | @end 12 | 13 | @implementation VeePostalAddressTests 14 | 15 | - (void)setUp 16 | { 17 | [super setUp]; 18 | } 19 | 20 | - (void)tearDown 21 | { 22 | [super tearDown]; 23 | } 24 | 25 | - (void)testCompleteUnifiedAddress 26 | { 27 | VeePostalAddress * veePostalAddress = [[VeePostalAddress alloc] initWithStreet:@"Campo dei Fiori" city:@"Roma" state:@"Lazio" postal:@"20123" country:@"Italy"]; 28 | NSString* expectedUnifiedAddress = @"Campo dei Fiori, Roma, Lazio, 20123, Italy"; 29 | BOOL isUnifiedAddressCorrect = [expectedUnifiedAddress isEqualToString:[veePostalAddress unifiedAddress]]; 30 | NSAssert(isUnifiedAddressCorrect, @"Unified address is %@ but should be %@",[veePostalAddress unifiedAddress], expectedUnifiedAddress); 31 | } 32 | 33 | - (void)testUnifiedAddressWithOnlyCity 34 | { 35 | VeePostalAddress * veePostalAddress = [[VeePostalAddress alloc] initWithStreet:nil city:@"Roma" state:nil postal:nil country:nil]; 36 | NSString* expectedUnifiedAddress = @"Roma"; 37 | BOOL isUnifiedAddressCorrect = [expectedUnifiedAddress isEqualToString:[veePostalAddress unifiedAddress]]; 38 | NSAssert(isUnifiedAddressCorrect, @"Unified address is %@ but should be %@",[veePostalAddress unifiedAddress], expectedUnifiedAddress); 39 | } 40 | 41 | - (void)testUnifiedAddressWithoutParametersShouldBeEmpty 42 | { 43 | VeePostalAddress * veePostalAddress = [[VeePostalAddress alloc] initWithStreet:nil city:nil state:nil postal:nil country:nil]; 44 | NSString* expectedUnifiedAddress = @""; 45 | BOOL isUnifiedAddressCorrect = [expectedUnifiedAddress isEqualToString:[veePostalAddress unifiedAddress]]; 46 | NSAssert(isUnifiedAddressCorrect, @"Unified address is %@ but should be %@",[veePostalAddress unifiedAddress], expectedUnifiedAddress); 47 | } 48 | 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /Example/Tests/Res/Fake contact entries/EmailDomains.txt: -------------------------------------------------------------------------------- 1 | gmail.com 2 | yahoo.com 3 | hotmail.it 4 | hotmail.com 5 | daum.net 6 | yahoo.co.uk 7 | live.com 8 | outlook.fr 9 | mail.ru 10 | qq.com 11 | outlook.com -------------------------------------------------------------------------------- /Example/Tests/Res/Fake contact entries/FakePhoneNumbers.txt: -------------------------------------------------------------------------------- 1 | +1 202-555-0154 2 | +1 202-555-0136 3 | +1 202-555-0120 4 | +1 202-555-0100 5 | +1 202-555-0171 6 | +1 202-555-0196 7 | +44 1632 960869 8 | +44 1632 960539 9 | +44 1632 960124 10 | +44 1632 960992 11 | +44 1632 960401 12 | +44 1632 960703 13 | +1-613-555-0158 14 | +1-613-555-0168 15 | +1-613-555-0109 16 | +1-613-555-0197 17 | +1-613-555-0132 18 | +1-613-555-0126 19 | +61 1900 654 321 20 | +39 3331234567 21 | +39 3331234568 22 | +39 3331234569 23 | +39 3331234565 24 | +39 3331234564 -------------------------------------------------------------------------------- /Example/Tests/Res/Fake contact entries/FirstNames.txt: -------------------------------------------------------------------------------- 1 | Mercedes 2 | Raelene 3 | Micheline 4 | Benedict 5 | Alease 6 | Yadira 7 | Claudette 8 | Tessie 9 | Ira 10 | Joeann 11 | Idalia 12 | Fae 13 | Darci 14 | Fritz 15 | Heath 16 | Alyssa 17 | Rossie 18 | Wen 19 | Sudie 20 | Loretta 21 | Dorris 22 | Gaynelle 23 | Shizue 24 | Dionna 25 | Ella 26 | Deloris 27 | Eneida 28 | Mariah 29 | Narcisa 30 | Pilar 31 | Delphia 32 | Candy 33 | Lucilla 34 | Wilda 35 | Elanor 36 | Jesenia 37 | Karine 38 | Majorie 39 | Dirk 40 | Agripina 41 | Mitchell 42 | Kortney 43 | Charley 44 | Isabelle 45 | Bee 46 | Merri 47 | Marianne 48 | Alicia 49 | Maria 50 | Floyd 51 | -------------------------------------------------------------------------------- /Example/Tests/Res/Fake contact entries/LastNames.txt: -------------------------------------------------------------------------------- 1 | Sigmund 2 | Wragg 3 | Boise 4 | Heavner 5 | Niemi 6 | Garey 7 | Wehmeyer 8 | Farrell 9 | Garrard 10 | Shellenberger 11 | Beck 12 | Brekke 13 | Guo 14 | Brune 15 | Eskridge 16 | Pennebaker 17 | Gregori 18 | Deloera 19 | Harms 20 | Ballew 21 | Yelle 22 | Burgo 23 | Bodenhamer 24 | Levens 25 | Riker 26 | Rudy 27 | Demoss 28 | Barratt 29 | Vannatter 30 | Moynihan 31 | Mcnabb 32 | Yohn 33 | Byrnes 34 | Carreon 35 | Clever 36 | Lanier 37 | Worrall 38 | Burbach 39 | Nathaniel 40 | Ragusa 41 | Vereen 42 | Sandiford 43 | Prudhomme 44 | Borgen 45 | Dandy 46 | Dillman 47 | Gallop 48 | Pellerin 49 | Fyffe 50 | Mayson -------------------------------------------------------------------------------- /Example/Tests/Res/Fake contact entries/MiddleNames.txt: -------------------------------------------------------------------------------- 1 | Terese 2 | Weston 3 | Onie 4 | Hank 5 | Jerome 6 | Dan 7 | Steffanie 8 | Tessa 9 | Peggy 10 | Anh 11 | Chantelle 12 | Sharyn 13 | Fermin 14 | Melvin 15 | Terrence 16 | Alleen 17 | Hang 18 | Pearly 19 | Joeann 20 | Faustino 21 | Blanche 22 | Evelia 23 | Dacia 24 | Larhonda 25 | Cuc 26 | Bong 27 | Tameka 28 | Caryn 29 | Levi 30 | Rosaline 31 | Carolyne 32 | Rhoda 33 | Rod 34 | Cyril 35 | Brooke 36 | Hattie 37 | Gil 38 | Shyla 39 | Angila 40 | Bertram 41 | Allison 42 | Genny 43 | Markita 44 | Cora 45 | Eddy 46 | Zenobia 47 | Daina 48 | Keila 49 | Thanh 50 | Sarai -------------------------------------------------------------------------------- /Example/Tests/Res/Fake contact entries/Nicknames.txt: -------------------------------------------------------------------------------- 1 | TheDreamer 2 | Pippa 3 | Pulce 4 | Ghost92 5 | Bodybuilder87 6 | Ant 7 | Barbie88 8 | CoCo 9 | Lily 10 | FunnyBoy -------------------------------------------------------------------------------- /Example/Tests/Res/Fake contact entries/OrganizationNames.txt: -------------------------------------------------------------------------------- 1 | Azienda SRL 2 | Company LTD 3 | Big Company SPA 4 | Unternehmen GmbH 5 | Companie 6 | Társaság -------------------------------------------------------------------------------- /Example/Tests/Res/vee_test_image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeAtlas/VeeContactPicker/0237f5468a5b85bca2c6e8ac476692b5b413604e/Example/Tests/Res/vee_test_image.png -------------------------------------------------------------------------------- /Example/Tests/Supporting Files/Tests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /Example/Tests/Supporting Files/Tests-Prefix.pch: -------------------------------------------------------------------------------- 1 | // The contents of this file are implicitly included at the beginning of every test case source file. 2 | 3 | #ifdef __OBJC__ 4 | 5 | #endif 6 | -------------------------------------------------------------------------------- /Example/Tests/Supporting Files/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Example/Tests/Testing Utils/AddressBookForTesting/VeeAddressBookForTesting.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Andrea Cipriani on 08/03/16. 3 | // Copyright © 2016 Code Atlas SRL. All rights reserved. 4 | // 5 | 6 | #import 7 | @import AddressBook; 8 | 9 | @interface VeeAddressBookForTesting : NSObject 10 | 11 | - (void)addVeeTestingContactsToAddressBook; 12 | - (void)deleteVeeTestingContactsFromAddressBook; 13 | @property (NS_NONATOMIC_IOSONLY, readonly) ABRecordRef abRecordRefOfCompleteContact CF_RETURNS_NOT_RETAINED; 14 | @property (NS_NONATOMIC_IOSONLY, readonly) ABRecordRef abRecordRefOfUnifiedContact CF_RETURNS_NOT_RETAINED; 15 | @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSArray *abRecordRefsOfTestingContacts; 16 | //- (void)exportABtoVCF:(NSString*)vcfFileName; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Example/Tests/Testing Utils/AddressBookForTesting/VeeAddressBookForTestingConstants.h: -------------------------------------------------------------------------------- 1 | // 2 | // VeeAddressBookForTestingConstants.h 3 | // VeeContactPicker 4 | // 5 | // Created by Andrea Cipriani on 10/03/16. 6 | // Copyright © 2016 Code Atlas SRL. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface VeeAddressBookForTestingConstants : NSObject 12 | 13 | extern NSString* const kVCFFileName; 14 | extern NSString* const kVeeTestingContactsSignature; 15 | 16 | #pragma mark - Testing contacts 17 | extern NSInteger const kVeeTestingContactsNumber; 18 | extern NSInteger const kVeeTestingContactsWithImage; 19 | extern NSInteger const kVeeTestingContactsPhoneNumbersCount; 20 | extern NSInteger const kVeeTestingContactsEmailsCount; 21 | 22 | #pragma mark - Complete contact 23 | extern NSString* const kCompleteVeeContactFirstName; 24 | extern NSString* const kCompleteVeeContactMiddleName; 25 | extern NSString* const kCompleteVeeContactLastName; 26 | extern NSString* const kCompleteVeeContactNickname; 27 | extern NSString* const kCompleteVeeContactOrganizationName; 28 | extern NSString* const kCompleteVeeContactCompositeName; 29 | extern NSString* const kCompleteVeeContactDisplayNameFirstNameFirst; 30 | extern NSString* const kCompleteVeeContactDisplayNameLastNameFirst; 31 | extern NSInteger const kCompleteVeeContactPhoneNumbersCount; 32 | extern NSInteger const kCompleteVeeContactEmailsCount; 33 | extern NSInteger const kCompleteVeeContactPostalAddressesCount; 34 | extern NSString* const kCompleteVeeContactPostalCorsoSempioneStreet; 35 | extern NSString* const kCompleteVeeContactPostalCorsoSempioneCity; 36 | extern NSString* const kCompleteVeeContactPostalCorsoSempioneState; 37 | extern NSString* const kCompleteVeeContactPostalCorsoSempionePostal; 38 | extern NSString* const kCompleteVeeContactPostalCorsoSempioneCountry; 39 | extern NSInteger const kCompleteVeeContactWebsitesCount; 40 | extern NSString* const kCompleteVeeContactSectionIdentifier; 41 | extern NSString* const kCompleteVeeContactWithoutFirstNameSectionIdentifier; 42 | extern NSString* const kCompleteVeeContactWithoutFirstNameAndLastNameSectionIdentifier; 43 | extern NSString* const kCompleteVeeContactEmptyDisplayNameSectionIdentifier; 44 | extern NSString* const kCompleteVeeContactTwitterAccount; 45 | extern NSString* const kCompleteVeeContactFacebookAccount; 46 | 47 | #pragma mark - Unified contact 48 | extern NSString* const kUnifiedVeecontactFirstName; 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /Example/Tests/Testing Utils/AddressBookForTesting/VeeAddressBookForTestingConstants.m: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Andrea Cipriani on 10/03/16. 3 | // Copyright © 2016 Code Atlas SRL. All rights reserved. 4 | // 5 | 6 | #import "VeeAddressBookForTestingConstants.h" 7 | 8 | @implementation VeeAddressBookForTestingConstants 9 | 10 | NSString* const kVCFFileName = @"vee_testing_ab"; 11 | 12 | NSString* const kVeeTestingContactsSignature = @"a8a8f8738b79cd660f519c1a342654a0"; 13 | 14 | #pragma mark - Testing contacts 15 | NSInteger const kVeeTestingContactsNumber = 21; 16 | NSInteger const kVeeTestingContactsWithImage = 11; 17 | NSInteger const kVeeTestingContactsPhoneNumbersCount = 32; 18 | NSInteger const kVeeTestingContactsEmailsCount = 34; 19 | 20 | #pragma mark - Complete contact 21 | NSString* const kCompleteVeeContactFirstName = @"Complete"; 22 | NSString* const kCompleteVeeContactMiddleName = @"middle"; 23 | NSString* const kCompleteVeeContactLastName = @"Contact"; 24 | NSString* const kCompleteVeeContactNickname = @"Supername"; 25 | NSString* const kCompleteVeeContactOrganizationName = @"Fake SRL"; 26 | NSString* const kCompleteVeeContactCompositeName = @"Complete middle Contact"; 27 | NSString* const kCompleteVeeContactDisplayNameFirstNameFirst = @"Complete middle Contact"; 28 | NSString* const kCompleteVeeContactDisplayNameLastNameFirst = @"Contact middle Complete"; 29 | NSInteger const kCompleteVeeContactPhoneNumbersCount = 5; 30 | NSInteger const kCompleteVeeContactEmailsCount = 4; 31 | NSInteger const kCompleteVeeContactPostalAddressesCount = 1; 32 | NSString* const kCompleteVeeContactPostalCorsoSempioneStreet = @"Corso Sempione"; 33 | NSString* const kCompleteVeeContactPostalCorsoSempioneCity = @"Milano"; 34 | NSString* const kCompleteVeeContactPostalCorsoSempioneState = @"Lombardia"; 35 | NSString* const kCompleteVeeContactPostalCorsoSempionePostal = @"20035"; 36 | NSString* const kCompleteVeeContactPostalCorsoSempioneCountry = @"Italia"; 37 | NSInteger const kCompleteVeeContactWebsitesCount = 4; 38 | NSString* const kCompleteVeeContactSectionIdentifier = @"C"; 39 | NSString* const kCompleteVeeContactWithoutFirstNameSectionIdentifier = @"C"; 40 | NSString* const kCompleteVeeContactWithoutFirstNameAndLastNameSectionIdentifier = @"F"; 41 | NSString* const kCompleteVeeContactEmptyDisplayNameSectionIdentifier = @"#"; 42 | NSString* const kCompleteVeeContactTwitterAccount = @"CompleteTwitter"; 43 | NSString* const kCompleteVeeContactFacebookAccount = @"CompleteFacebook"; 44 | 45 | #pragma mark - Unified contact 46 | NSString* const kUnifiedVeecontactFirstName = @"Unified"; 47 | 48 | @end -------------------------------------------------------------------------------- /Example/Tests/Testing Utils/VeeContactsForTestingFactory.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Andrea Cipriani on 16/03/16. 3 | // Copyright © 2016 Code Atlas SRL. All rights reserved. 4 | // 5 | 6 | #import 7 | #import "VeeContactProt.h" 8 | @class VeeContact; 9 | 10 | @interface VeeContactsForTestingFactory : NSObject 11 | 12 | + (VeeContact*)veeContactComplete; 13 | + (NSArray>*)createRandomVeeContacts:(NSUInteger)numberOfVeeContacts; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Example/Tests/Testing Utils/VeeSectionableForTesting.h: -------------------------------------------------------------------------------- 1 | #import "VeeSectionable.h" 2 | #import 3 | 4 | @interface VeeSectionableForTesting : NSObject 5 | 6 | - (instancetype)initWithSectionIdentifier:(NSString*)sectionIdentifier; 7 | @property (nonatomic, copy) NSString* sectionIdentifier; 8 | @property (nonatomic, copy) NSString* id; 9 | 10 | @end 11 | -------------------------------------------------------------------------------- /Example/Tests/Testing Utils/VeeSectionableForTesting.m: -------------------------------------------------------------------------------- 1 | #import "VeeSectionableForTesting.h" 2 | 3 | @implementation VeeSectionableForTesting 4 | 5 | -(instancetype)initWithSectionIdentifier:(NSString*)sectionIdentifier 6 | { 7 | self = [super init]; 8 | if (self) { 9 | _id = [NSProcessInfo processInfo].globallyUniqueString; 10 | _sectionIdentifier = sectionIdentifier; 11 | } 12 | return self; 13 | } 14 | 15 | - (instancetype)init 16 | { 17 | self = [super init]; 18 | if (self) { 19 | _id = [NSProcessInfo processInfo].globallyUniqueString; 20 | } 21 | return self; 22 | } 23 | 24 | -(NSString*)description 25 | { 26 | return [NSString stringWithFormat:@"VeeSectionableForTesting id: %@ sectionIdentifier: %@",_id,_sectionIdentifier]; 27 | } 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /Example/Tests/Testing Utils/XCTest+VeeCommons.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Andrea Cipriani on 10/03/16. 3 | // Copyright © 2016 Code Atlas SRL. All rights reserved. 4 | // 5 | 6 | #import 7 | 8 | @interface XCTest (VeeCommons) 9 | 10 | - (void)nullifyIvarWithName:(NSString*)iVarSelectorName ofObject:(id)object; 11 | - (void)assertObject:(id)object respondToSelectorWithName:(NSString*)selectorName; 12 | @property (NS_NONATOMIC_IOSONLY, readonly, strong) UIImage *veeTestImage; 13 | @property (NS_NONATOMIC_IOSONLY, readonly, strong) NSBundle *veeContactPickerBundle; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Example/Tests/Testing Utils/XCTest+VeeCommons.m: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Andrea Cipriani on 10/03/16. 3 | // Copyright © 2016 Code Atlas SRL. All rights reserved. 4 | // 5 | 6 | #import "XCTest+VeeCommons.h" 7 | #import "VeeContactPickerViewController.h" 8 | 9 | @implementation XCTest (VeeCommons) 10 | 11 | -(void)nullifyIvarWithName:(NSString*)iVarSelectorName ofObject:(id)object 12 | { 13 | [self assertObject:object respondToSelectorWithName:iVarSelectorName]; 14 | [object setValue:nil forKey:iVarSelectorName]; 15 | } 16 | 17 | -(void)assertObject:(id)object respondToSelectorWithName:(NSString*)selectorName 18 | { 19 | SEL selector = NSSelectorFromString(selectorName); 20 | BOOL objectRespondToSelector = [object respondsToSelector:selector]; 21 | NSAssert(objectRespondToSelector,@"%@ doesn't respond to selector %@",[object class],selectorName); 22 | } 23 | 24 | -(UIImage*)veeTestImage 25 | { 26 | NSBundle *bundle = [NSBundle bundleForClass:[self class]]; 27 | NSString *imagePath = [bundle pathForResource:@"vee_test_image" ofType:@"png"]; 28 | UIImage *veeTestImage = [UIImage imageWithContentsOfFile:imagePath]; 29 | NSAssert(veeTestImage, @"vee test image not found"); 30 | return veeTestImage; 31 | } 32 | 33 | -(NSBundle*)veeContactPickerBundle 34 | { 35 | NSBundle* bundle = [NSBundle bundleForClass:VeeContactPickerViewController.class]; 36 | NSURL* bundleURL = [bundle URLForResource:@"VeeContactPicker" withExtension:@"bundle"]; 37 | return [NSBundle bundleWithURL:bundleURL]; 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /Example/Tests/Tests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /Example/Tests/Tests-Prefix.pch: -------------------------------------------------------------------------------- 1 | // The contents of this file are implicitly included at the beginning of every test case source file. 2 | 3 | #ifdef __OBJC__ 4 | 5 | 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /Example/Tests/Utils and categories/UILabelBolfidyTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Andrea Cipriani on 29/03/16. 3 | // Copyright © 2016 Code Atlas SRL. All rights reserved. 4 | // 5 | 6 | #import 7 | #import "UILabel+VeeBoldify.h" 8 | @interface UILabelBolfidyTests : XCTestCase 9 | 10 | @end 11 | 12 | @implementation UILabelBolfidyTests 13 | 14 | - (void)setUp { 15 | [super setUp]; 16 | } 17 | 18 | - (void)tearDown { 19 | [super tearDown]; 20 | } 21 | 22 | -(void)testBoldSubString 23 | { 24 | UILabel* label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 200, 30)]; 25 | NSString* completeString = @"foo bar"; 26 | NSString* shouldNotBeBoldSubstring = @"foo "; 27 | NSString* shouldBeBoldSubstring = @"bar"; 28 | label.text = completeString; 29 | [label vee_boldSubstring:shouldBeBoldSubstring]; 30 | 31 | BOOL shouldBeBold = [self isLabelFontBold:label forSubstring:shouldBeBoldSubstring] == YES; 32 | BOOL shouldNotBeBold = [self isLabelFontBold:label forSubstring:shouldNotBeBoldSubstring] == NO; 33 | NSAssert(shouldBeBold, @"Substring should be bold"); 34 | NSAssert(shouldNotBeBold, @"Substring should not be bold"); 35 | } 36 | 37 | -(void)testBoldNonExistingSubString 38 | { 39 | UILabel* label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 200, 30)]; 40 | label.text = @"foo bar"; 41 | [label vee_boldSubstring:@"lol"]; 42 | BOOL shouldNotBeBold = [self isLabelFontBold:label forSubstring:@"lol"] == NO; 43 | NSAssert(shouldNotBeBold, @"Substring should not be bold"); 44 | } 45 | 46 | -(BOOL)isLabelFontBold:(UILabel*)label forSubstring:(NSString*)substring 47 | { 48 | NSString* completeString = label.text; 49 | NSRange boldRange = [completeString rangeOfString:substring]; 50 | return [self isLabelFontBold:label forRange:boldRange]; 51 | } 52 | 53 | -(BOOL)isLabelFontBold:(UILabel*)label forRange:(NSRange)range 54 | { 55 | NSAttributedString * attributedLabelText = label.attributedText; 56 | 57 | __block BOOL isRangeBold = NO; 58 | 59 | [attributedLabelText enumerateAttribute:NSFontAttributeName inRange:range options:0 usingBlock:^(UIFont *font, NSRange range, BOOL *stop) { 60 | if (font) { 61 | if ([self isFontBold:font]){ 62 | isRangeBold = YES; 63 | } 64 | } 65 | }]; 66 | 67 | return isRangeBold; 68 | } 69 | 70 | -(BOOL)isFontBold:(UIFont*)font 71 | { 72 | UIFontDescriptor *fontDescriptor = font.fontDescriptor; 73 | UIFontDescriptorSymbolicTraits fontDescriptorSymbolicTraits = fontDescriptor.symbolicTraits; 74 | BOOL isBold = (fontDescriptorSymbolicTraits & UIFontDescriptorTraitBold) != 0; 75 | return isBold; 76 | } 77 | 78 | @end 79 | -------------------------------------------------------------------------------- /Example/Tests/Utils and categories/VeeIsEmptyTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Andrea Cipriani on 21/03/16. 3 | // Copyright © 2016 Code Atlas SRL. All rights reserved. 4 | // 5 | 6 | #import "VeeCommons.h" 7 | #import 8 | 9 | @interface VeeCommonsTests : XCTestCase 10 | 11 | @end 12 | 13 | @implementation VeeCommonsTests 14 | 15 | - (void)testIsEmpty 16 | { 17 | NSAssert([VeeCommons vee_isEmpty:@""] == YES, @"an empty string should be empty"); 18 | NSAssert([VeeCommons vee_isEmpty:@"foo"] == NO, @"foo should not be empty"); 19 | } 20 | 21 | - (void)testIsNotEmpty 22 | { 23 | NSAssert([VeeCommons vee_isNotEmpty:@""] == NO, @"an empty string should be empty"); 24 | NSAssert([VeeCommons vee_isNotEmpty:@"foo"] == YES, @"foo should not be empty"); 25 | } 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /Example/Tests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Example/VeeContactPicker.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example/VeeContactPicker.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Example/VeeContactPicker/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Example/VeeContactPicker/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | } 88 | ], 89 | "info" : { 90 | "version" : 1, 91 | "author" : "xcode" 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /Example/VeeContactPicker/VeeAppDelegate.h: -------------------------------------------------------------------------------- 1 | @import UIKit; 2 | 3 | @interface VeeAppDelegate : UIResponder 4 | @property (strong, nonatomic) UIWindow *window; 5 | @end 6 | -------------------------------------------------------------------------------- /Example/VeeContactPicker/VeeAppDelegate.m: -------------------------------------------------------------------------------- 1 | #import "VeeAppDelegate.h" 2 | 3 | @implementation VeeAppDelegate 4 | 5 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 6 | { 7 | return YES; 8 | } 9 | 10 | @end 11 | -------------------------------------------------------------------------------- /Example/VeeContactPicker/VeeContactPicker-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UILaunchStoryboardName 28 | LaunchScreen 29 | UIMainStoryboardFile 30 | Main 31 | UIRequiredDeviceCapabilities 32 | 33 | armv7 34 | 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | NSContactsUsageDescription 47 | This app requires contacts access to function properly. 48 | 49 | 50 | -------------------------------------------------------------------------------- /Example/VeeContactPicker/VeeContactPicker-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #import 8 | 9 | #ifndef __IPHONE_5_0 10 | #warning "This project uses features only available in iOS SDK 5.0 and later." 11 | #endif 12 | 13 | #ifdef __OBJC__ 14 | @import UIKit; 15 | @import Foundation; 16 | #endif 17 | -------------------------------------------------------------------------------- /Example/VeeContactPicker/VeeContactPickerExampleViewController.h: -------------------------------------------------------------------------------- 1 | @import UIKit; 2 | @protocol VeeContactPickerDelegate; 3 | @interface VeeContactPickerExampleViewController : UIViewController 4 | @end 5 | -------------------------------------------------------------------------------- /Example/VeeContactPicker/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Example/VeeContactPicker/main.m: -------------------------------------------------------------------------------- 1 | @import UIKit; 2 | #import "VeeAppDelegate.h" 3 | 4 | int main(int argc, char * argv[]) 5 | { 6 | @autoreleasepool { 7 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([VeeAppDelegate class])); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016 Code Atlas SRL 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /RELEASES.md: -------------------------------------------------------------------------------- 1 | ### VeeContactPicker releases 2 | - **v1.2** 3 | - Styling improvements, thanks to [@Husseinhj](https://github.com/Husseinhj) 4 | - **v1.1** 5 | - Bug fix: avoid crashing when a social username is nil, thanks to [@freeskys](https://github.com/freeskys) 6 | - **v1.0** 7 | - Enabled support for selecting multiple contacts 8 | - iPad support 9 | - The minimum target is now iOS 8 10 | - Removed some external dependencies 11 | - Changed public API's 12 | - **v0.1** 13 | - VeeContactPicker first release! You can select a contact from your address book 14 | -------------------------------------------------------------------------------- /Screenshots/VeeContactPicker.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeAtlas/VeeContactPicker/0237f5468a5b85bca2c6e8ac476692b5b413604e/Screenshots/VeeContactPicker.gif -------------------------------------------------------------------------------- /Screenshots/VeeContactPickerScreen1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeAtlas/VeeContactPicker/0237f5468a5b85bca2c6e8ac476692b5b413604e/Screenshots/VeeContactPickerScreen1.png -------------------------------------------------------------------------------- /VeeContactPicker.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # Be sure to run `pod lib lint VeeContactPicker.podspec' to ensure this is a 3 | # valid spec before submitting. 4 | 5 | Pod::Spec.new do |s| 6 | s.name = "VeeContactPicker" 7 | s.version = "1.3" 8 | s.summary = "A replacement for the iOS ABPeoplePickerNavigationController, with contacts' images" 9 | s.description = "VeeContactPicker is a replacement for the (bugged) ABPeoplePickerNavigationController. You can use it to let the user choose a contact from the address book." 10 | s.homepage = "https://github.com/CodeAtlas/VeeContactPicker" 11 | s.screenshots = "https://raw.githubusercontent.com/CodeAtlas/VeeContactPicker/master/Screenshots/VeeContactPickerScreen1.png 12 | " 13 | s.license = 'MIT' 14 | s.author = { "Code Atlas SRL" => "info@codeatlas.it" } 15 | s.source = { :git => "https://github.com/CodeAtlas/VeeContactPicker.git", :tag => s.version.to_s } 16 | s.social_media_url = 'https://github.com/CodeAtlas' 17 | s.ios.deployment_target = '8.0' 18 | s.requires_arc = true 19 | s.source_files = 'VeeContactPicker/Classes/**/*' 20 | s.resource_bundles = { 21 | #'VeeContactPicker' => ['VeeContactPicker/Assets/*.png'] 22 | } 23 | s.public_header_files = 'VeeContactPicker/Classes/**/*.h' 24 | s.frameworks = 'UIKit', 'AddressBook' 25 | s.dependency 'UIImageView-AGCInitials' 26 | 27 | end 28 | -------------------------------------------------------------------------------- /VeeContactPicker/Classes/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeAtlas/VeeContactPicker/0237f5468a5b85bca2c6e8ac476692b5b413604e/VeeContactPicker/Classes/.gitkeep -------------------------------------------------------------------------------- /VeeContactPicker/Classes/Controller/Address Book/VeeABDelegate.h: -------------------------------------------------------------------------------- 1 | @import Foundation; 2 | 3 | @protocol VeeABDelegate 4 | - (void)abPermissionsGranted; 5 | - (void)abPermissionsNotGranted; 6 | @end 7 | -------------------------------------------------------------------------------- /VeeContactPicker/Classes/Controller/Address Book/VeeABRecordsImporter.h: -------------------------------------------------------------------------------- 1 | @import Foundation; 2 | @import AddressBook; 3 | @class VeeABRecord; 4 | 5 | NS_ASSUME_NONNULL_BEGIN 6 | 7 | @interface VeeABRecordsImporter : NSObject 8 | - (NSArray*)importVeeABRecordsFromAddressBook:(ABAddressBookRef)addressBook; 9 | @end 10 | 11 | NS_ASSUME_NONNULL_END 12 | -------------------------------------------------------------------------------- /VeeContactPicker/Classes/Controller/Address Book/VeeABRecordsImporter.m: -------------------------------------------------------------------------------- 1 | #import "VeeABRecordsImporter.h" 2 | #import "VeeABRecord.h" 3 | 4 | NS_ASSUME_NONNULL_BEGIN 5 | 6 | @implementation VeeABRecordsImporter 7 | 8 | #pragma mark - Public methods 9 | 10 | - (NSArray*)importVeeABRecordsFromAddressBook:(ABAddressBookRef)addressBook 11 | { 12 | if (ABAddressBookGetAuthorizationStatus() != kABAuthorizationStatusAuthorized){ 13 | NSLog(@"Can't import contacts: ABAuthStatus is not authorized"); 14 | return @[]; 15 | } 16 | NSArray *allSources = (__bridge_transfer NSArray*)(ABAddressBookCopyArrayOfAllSources(addressBook)); 17 | NSMutableSet *veeABRecords = [NSMutableSet new]; 18 | 19 | for (int s = 0; s < allSources.count; s++) { 20 | ABRecordRef source = (__bridge ABRecordRef)(allSources[s]); 21 | [veeABRecords addObjectsFromArray:[self importVeeABRecordsFromSingleSource:source ofAddressBook:addressBook]]; 22 | } 23 | return [NSArray arrayWithArray:veeABRecords.allObjects]; 24 | } 25 | 26 | - (NSArray*)importVeeABRecordsFromSingleSource:(ABRecordRef)source ofAddressBook:(ABAddressBookRef)addressBook 27 | { 28 | NSMutableArray* abRepositoryOfSingleSourceData = [NSMutableArray new]; 29 | NSArray* peopleInSource = CFBridgingRelease(ABAddressBookCopyArrayOfAllPeopleInSource(addressBook, source)); 30 | for (int i = 0; i < peopleInSource.count; i++) { 31 | ABRecordRef abRecord = CFArrayGetValueAtIndex((__bridge CFArrayRef)(peopleInSource), i); 32 | VeeABRecord* veeABRecord = [[VeeABRecord alloc] initWithLinkedPeopleOfABRecord:abRecord]; 33 | [abRepositoryOfSingleSourceData addObject:veeABRecord]; 34 | } 35 | return [NSArray arrayWithArray:abRepositoryOfSingleSourceData]; 36 | } 37 | 38 | @end 39 | 40 | NS_ASSUME_NONNULL_END 41 | -------------------------------------------------------------------------------- /VeeContactPicker/Classes/Controller/Address Book/VeeAddressBook.h: -------------------------------------------------------------------------------- 1 | @import Foundation; 2 | @import AddressBook; 3 | #import "VeeABDelegate.h" 4 | 5 | NS_ASSUME_NONNULL_BEGIN 6 | 7 | @interface VeeAddressBook : NSObject 8 | 9 | @property (nonatomic,strong) id delegate; 10 | - (void)askABPermissionsWithDelegate:(ABAddressBookRef)addressBookRef; 11 | + (BOOL)hasABPermissions; 12 | + (BOOL)isABSortOrderingByFirstName; 13 | 14 | @end 15 | 16 | NS_ASSUME_NONNULL_END 17 | -------------------------------------------------------------------------------- /VeeContactPicker/Classes/Controller/Address Book/VeeAddressBook.m: -------------------------------------------------------------------------------- 1 | #import "VeeAddressBook.h" 2 | 3 | NS_ASSUME_NONNULL_BEGIN 4 | 5 | @implementation VeeAddressBook 6 | 7 | - (instancetype)initWithVeeABDelegate:(id)delegate 8 | { 9 | self = [super init]; 10 | if (self) { 11 | _delegate = delegate; 12 | } 13 | return self; 14 | } 15 | 16 | - (void)askABPermissionsWithDelegate:(ABAddressBookRef)addressBookRef 17 | { 18 | ABAddressBookRequestAccessWithCompletion(addressBookRef, ^(bool granted, CFErrorRef error) { 19 | if (granted){ 20 | [_delegate abPermissionsGranted]; 21 | } 22 | else{ 23 | [_delegate abPermissionsNotGranted]; 24 | } 25 | }); 26 | } 27 | 28 | + (BOOL)hasABPermissions 29 | { 30 | if (ABAddressBookGetAuthorizationStatus() == kABAuthorizationStatusAuthorized) { 31 | return YES; 32 | } 33 | return NO; 34 | } 35 | 36 | + (BOOL)isABSortOrderingByFirstName 37 | { 38 | return ABPersonGetSortOrdering() == kABPersonSortByFirstName; 39 | } 40 | 41 | @end 42 | 43 | NS_ASSUME_NONNULL_END 44 | -------------------------------------------------------------------------------- /VeeContactPicker/Classes/Controller/ViewController/UITableViewCells/VeeContactCellConfiguration.h: -------------------------------------------------------------------------------- 1 | @import Foundation; 2 | #import "VeeContactProt.h" 3 | @class VeeContactTableViewCell; 4 | @class VeeContactPickerOptions; 5 | 6 | NS_ASSUME_NONNULL_BEGIN 7 | 8 | @interface VeeContactCellConfiguration : NSObject 9 | 10 | #pragma mark - Initializers 11 | 12 | - (instancetype)init NS_UNAVAILABLE; 13 | - (instancetype)initWithVeePickerOptions:(VeeContactPickerOptions*)veeContactPickerOptions NS_DESIGNATED_INITIALIZER; 14 | 15 | #pragma mark - Public Methods 16 | 17 | - (void)configureCell:(VeeContactTableViewCell*)cell forVeeContact:(id)veeContact; 18 | 19 | @end 20 | 21 | NS_ASSUME_NONNULL_END 22 | -------------------------------------------------------------------------------- /VeeContactPicker/Classes/Controller/ViewController/UITableViewCells/VeeContactCellConfiguration.m: -------------------------------------------------------------------------------- 1 | #import "VeeContactCellConfiguration.h" 2 | #import "VeeContactTableViewCell.h" 3 | #import "UILabel+VeeBoldify.h" 4 | #import "VeeContactPickerOptions.h" 5 | #import "UIImageView+AGCInitials.h" 6 | #import "VeeCommons.h" 7 | 8 | NS_ASSUME_NONNULL_BEGIN 9 | 10 | @interface VeeContactCellConfiguration () 11 | @property (nonatomic,strong) VeeContactPickerOptions *veeContactPickerOptions; 12 | @end 13 | 14 | @implementation VeeContactCellConfiguration 15 | 16 | #pragma mark - Initializers 17 | 18 | - (instancetype)initWithVeePickerOptions:(VeeContactPickerOptions*)veeContactPickerOptions 19 | { 20 | self = [super init]; 21 | if (self) { 22 | _veeContactPickerOptions = veeContactPickerOptions; 23 | } 24 | return self; 25 | } 26 | 27 | #pragma mark - Public Methods 28 | 29 | - (void)configureCell:(VeeContactTableViewCell*)cell forVeeContact:(id)veeContact 30 | { 31 | [self configureCellLabels:cell forVeeContact:veeContact]; 32 | [self configureCellImage:cell forVeeContact:veeContact]; 33 | } 34 | 35 | #pragma mark - Private utils 36 | 37 | - (void)configureCellLabels:(VeeContactTableViewCell*)cell forVeeContact:(id)veeContact 38 | { 39 | cell.primaryLabel.text = [veeContact displayName]; 40 | NSArray* nameComponents = [[veeContact displayNameSortedForABOptions] componentsSeparatedByString:@" "]; 41 | BOOL isMissingANameComponent = [VeeCommons vee_isEmpty:veeContact.firstName] || [VeeCommons vee_isEmpty:veeContact.lastName]; 42 | BOOL nameComponentsAreLessThanOne = nameComponents.count < 1; 43 | NSString* toBoldify; 44 | if (isMissingANameComponent || nameComponentsAreLessThanOne){ 45 | toBoldify = [veeContact displayName]; 46 | } 47 | else { 48 | toBoldify = nameComponents.firstObject; 49 | } 50 | [cell.primaryLabel vee_boldSubstring:toBoldify]; 51 | } 52 | 53 | - (void)configureCellImage:(VeeContactTableViewCell*)cell forVeeContact:(id)veeContact 54 | { 55 | if (veeContact.thumbnailImage) { 56 | cell.contactImageView.image = veeContact.thumbnailImage; 57 | } 58 | else { 59 | if (_veeContactPickerOptions.showInitialsPlaceholder) { 60 | [cell.contactImageView agc_setImageWithInitialsFromName:[veeContact displayName] separatedByString:@" "]; 61 | } 62 | else { 63 | (cell.contactImageView).image = _veeContactPickerOptions.contactThumbnailImagePlaceholder; 64 | } 65 | } 66 | } 67 | 68 | @end 69 | 70 | NS_ASSUME_NONNULL_END 71 | -------------------------------------------------------------------------------- /VeeContactPicker/Classes/Controller/ViewController/UITableViewCells/VeeContactTableViewCell.h: -------------------------------------------------------------------------------- 1 | @import UIKit; 2 | 3 | NS_ASSUME_NONNULL_BEGIN 4 | 5 | @interface VeeContactTableViewCell : UITableViewCell 6 | @property (weak, nonatomic) IBOutlet UIImageView *contactImageView; 7 | @property (weak, nonatomic) IBOutlet UILabel *primaryLabel; 8 | @end 9 | 10 | NS_ASSUME_NONNULL_END 11 | -------------------------------------------------------------------------------- /VeeContactPicker/Classes/Controller/ViewController/UITableViewCells/VeeContactTableViewCell.m: -------------------------------------------------------------------------------- 1 | #import "VeeContactTableViewCell.h" 2 | @import QuartzCore; 3 | #import "VeeContactPickerAppearanceConstants.h" 4 | #import "VeeContactTableViewCell.h" 5 | #import "VeeContactPickerAppearanceConstants.h" 6 | 7 | @implementation VeeContactTableViewCell 8 | 9 | NS_ASSUME_NONNULL_BEGIN 10 | 11 | - (void)awakeFromNib 12 | { 13 | [super awakeFromNib]; 14 | self.backgroundColor = [VeeContactPickerAppearanceConstants sharedInstance].veeContactCellBackgroundColor; 15 | [self setCellSelectedBackgroundColor]; 16 | [self setupContactImageViewStyle]; 17 | [self setupPrimaryLabelStyle]; 18 | } 19 | 20 | - (void)setupContactImageViewStyle 21 | { 22 | _contactImageView.layer.cornerRadius = [[[VeeContactPickerAppearanceConstants sharedInstance] veeContactCellImageDiameter] floatValue] / 2; 23 | _contactImageView.contentMode = UIViewContentModeScaleAspectFill; 24 | _contactImageView.clipsToBounds = YES; 25 | } 26 | 27 | - (void)setupPrimaryLabelStyle 28 | { 29 | _primaryLabel.font = [[VeeContactPickerAppearanceConstants sharedInstance] veeContactCellPrimaryLabelFont]; 30 | } 31 | 32 | -(void)setCellSelectedBackgroundColor 33 | { 34 | UIView *selectedBackgroundView = [[UIView alloc] initWithFrame:self.bounds]; 35 | selectedBackgroundView.backgroundColor = [VeeContactPickerAppearanceConstants sharedInstance].veeContactCellBackgroundColorWhenSelected; 36 | self.selectedBackgroundView = selectedBackgroundView; 37 | } 38 | 39 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated 40 | { 41 | UIColor *backgroundColor = self.contactImageView.backgroundColor; 42 | [super setSelected:selected animated:animated]; 43 | self.contactImageView.backgroundColor = backgroundColor; 44 | } 45 | 46 | - (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated 47 | { 48 | UIColor *backgroundColor = self.contactImageView.backgroundColor; 49 | [super setHighlighted:highlighted animated:animated]; 50 | self.contactImageView.backgroundColor = backgroundColor; 51 | } 52 | 53 | -(void)prepareForReuse 54 | { 55 | [super prepareForReuse]; 56 | self.primaryLabel.text = @""; 57 | self.contactImageView.image = nil; 58 | } 59 | 60 | @end 61 | 62 | NS_ASSUME_NONNULL_END 63 | 64 | -------------------------------------------------------------------------------- /VeeContactPicker/Classes/Controller/ViewController/VeeContactPickerDelegate.h: -------------------------------------------------------------------------------- 1 | @import Foundation; 2 | #import "VeeContactProt.h" 3 | 4 | NS_ASSUME_NONNULL_BEGIN 5 | 6 | @protocol VeeContactPickerDelegate 7 | - (void)didSelectContact:(id)veeContact; 8 | - (void)didSelectContacts:(NSArray> *)veeContacts; 9 | - (void)didCancelContactSelection; 10 | - (void)didFailToAccessAddressBook; 11 | - (void)willLoadContactData; 12 | - (void)didLoadContactData; 13 | @end 14 | 15 | NS_ASSUME_NONNULL_END 16 | -------------------------------------------------------------------------------- /VeeContactPicker/Classes/Controller/ViewController/VeeContactPickerViewController.h: -------------------------------------------------------------------------------- 1 | @import UIKit; 2 | @import AddressBook; 3 | 4 | #import "VeeContactPickerDelegate.h" 5 | #import "VeeContactProt.h" 6 | #import "VeeABDelegate.h" 7 | @class VeeContactPickerOptions; 8 | @class VeeContactPickerStrings; 9 | 10 | NS_ASSUME_NONNULL_BEGIN 11 | 12 | @interface VeeContactPickerViewController : UIViewController 13 | 14 | #pragma mark - Init 15 | 16 | - (instancetype)init NS_UNAVAILABLE; 17 | - (instancetype)initWithDefaultConfiguration; 18 | - (instancetype)initWithOptions:(VeeContactPickerOptions*)veeContactPickerOptions; 19 | - (instancetype)initWithVeeContacts:(NSArray>*)veeContacts; 20 | - (instancetype)initWithOptions:(VeeContactPickerOptions*)veeContactPickerOptions 21 | veeContacts:(NSArray>*)veeContacts; 22 | 23 | @property (nonatomic, assign) BOOL multipleSelection; 24 | 25 | #pragma mark - Delegate and completion handler 26 | 27 | @property (nonatomic, weak) id contactPickerDelegate; 28 | @property (nonatomic, strong) void (^contactSelectionHandler)(id); 29 | 30 | #pragma mark - Public Outlets 31 | 32 | @property (weak, nonatomic) IBOutlet UITableView *contactsTableView; 33 | @property (weak, nonatomic) IBOutlet UIBarButtonItem *cancelBarButtonItem; 34 | @property (weak, nonatomic) IBOutlet UINavigationItem *titleNavigationItem; 35 | @property (weak, nonatomic) IBOutlet UILabel *emptyViewLabel; 36 | @property (weak, nonatomic) IBOutlet UIBarButtonItem *multipleSelectionDoneButton; 37 | 38 | 39 | #pragma mark - IBActions 40 | 41 | - (IBAction)cancelBarButtonItemPressed:(id)sender; 42 | - (IBAction)multipleSelectionDoneButtonItemPressed:(id)sender; 43 | 44 | @end 45 | 46 | NS_ASSUME_NONNULL_END 47 | -------------------------------------------------------------------------------- /VeeContactPicker/Classes/Controller/ViewController/View Controller utils/VeeSectionedArrayDataSource.h: -------------------------------------------------------------------------------- 1 | @import Foundation; 2 | @import UIKit; 3 | @protocol VeeContactProt; 4 | #import "VeeSectionable.h" 5 | 6 | NS_ASSUME_NONNULL_BEGIN 7 | 8 | @interface VeeSectionedArrayDataSource : NSObject 9 | 10 | typedef void (^ConfigureCellBlock)(id cell, id item); 11 | 12 | - (instancetype)init NS_UNAVAILABLE; 13 | -(instancetype)initWithItems:(NSArray>*)items 14 | cellIdentifier:(NSString*)cellIdentifier 15 | allowedSortedSectionIdentifiers:(NSArray*)allowedSortedSectionIdentifiers 16 | sectionIdentifierWildcard:(NSString*)sectionIdentifierWildcard 17 | searchController:(UISearchController *) searchController 18 | configurationCellBlock:(ConfigureCellBlock)configureCellBlock; 19 | 20 | #pragma mark - UITableViewDataSource 21 | 22 | - (NSInteger)numberOfSectionsInTableView:(UITableView*)tableView; 23 | - (NSInteger)tableView:(UITableView*)tableView numberOfRowsInSection:(NSInteger)section; 24 | - (NSString*)tableView:(UITableView*)tableView titleForHeaderInSection:(NSInteger)section; 25 | - (NSArray*)sectionIndexTitlesForTableView:(UITableView*)tableView; 26 | - (UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath; 27 | 28 | #pragma mark - Public methods 29 | 30 | - (id)tableView:(UITableView*)tableView itemAtIndexPath:(NSIndexPath*)indexPath; 31 | - (NSString *)sectionIdentifierForItem:(id)item; 32 | - (void)updateForSearchText:(NSString *)searchText selectedVeeContacts:(NSMutableArray>*)selectedVeeContacts; 33 | 34 | @end 35 | 36 | NS_ASSUME_NONNULL_END 37 | -------------------------------------------------------------------------------- /VeeContactPicker/Classes/Model/ContactPicker/VeeContactPickerAppearanceConstants.h: -------------------------------------------------------------------------------- 1 | @import Foundation; 2 | @import UIKit; 3 | 4 | NS_ASSUME_NONNULL_BEGIN 5 | 6 | @interface VeeContactPickerAppearanceConstants : NSObject 7 | 8 | + (instancetype)sharedInstance; //Initialization with default constants 9 | 10 | #pragma mark - Table view Constants 11 | 12 | @property (nonatomic, copy) NSString *veeContactCellIdentifier; 13 | @property (nonatomic, assign) NSUInteger veeContactCellHeight; 14 | 15 | #pragma mark - VeeContactPicker Appearance Constants 16 | 17 | @property (nonatomic, strong) UIColor *cancelBarButtonItemTintColor; 18 | @property (nonatomic, strong) UIColor *doneBarButtonItemTintColor; 19 | @property (nonatomic, strong) UIFont *barButtonItemsUIFont; 20 | @property (nonatomic, strong) UIColor *navigationBarTintColor; 21 | @property (nonatomic, strong) UIColor *navigationBarBarTintColor; 22 | @property (nonatomic, assign) BOOL navigationBarTranslucent; 23 | @property (nonatomic, strong) UIFont *veeContactEmptyViewLabelFont; 24 | @property (nonatomic, strong) UIColor *veeContactEmptyViewLabelTextColor; 25 | @property (nonatomic, assign) NSUInteger veeContactPickerTableViewBottomMargin; 26 | 27 | #pragma mark - VeeContactTableViewCell Appearance Constants 28 | 29 | @property (nonatomic, strong) NSNumber *veeContactCellImageDiameter; 30 | @property (nonatomic, strong) UIFont *veeContactCellPrimaryLabelFont; 31 | @property (nonatomic, strong) UIColor *veeContactCellBackgroundColor; 32 | @property (nonatomic, strong) UIColor *veeContactCellBackgroundColorWhenSelected; 33 | 34 | @end 35 | 36 | NS_ASSUME_NONNULL_END 37 | -------------------------------------------------------------------------------- /VeeContactPicker/Classes/Model/ContactPicker/VeeContactPickerAppearanceConstants.m: -------------------------------------------------------------------------------- 1 | #import "VeeContactPickerAppearanceConstants.h" 2 | 3 | NS_ASSUME_NONNULL_BEGIN 4 | 5 | @implementation VeeContactPickerAppearanceConstants 6 | 7 | #pragma mark - Singleton 8 | 9 | + (id)sharedInstance 10 | { 11 | static VeeContactPickerAppearanceConstants* sharedInstance = nil; 12 | static dispatch_once_t onceToken; 13 | dispatch_once(&onceToken, ^{ 14 | sharedInstance = [[self alloc] initWithDefaultConstants]; 15 | }); 16 | return sharedInstance; 17 | } 18 | 19 | - (instancetype)initWithDefaultConstants 20 | { 21 | if (self) { 22 | [self loadVeeContactPickerDefaultConstants]; 23 | [self loadTableViewDefaultConstants]; 24 | [self loadVeeContactTableViewCellDefaultConstants]; 25 | } 26 | return self; 27 | } 28 | 29 | - (void)loadTableViewDefaultConstants 30 | { 31 | self.veeContactCellIdentifier = @"VeeContactTableViewCell"; 32 | self.veeContactCellHeight = 66.0; 33 | } 34 | 35 | -(void)loadVeeContactPickerDefaultConstants 36 | { 37 | self.cancelBarButtonItemTintColor = [self iOS7DefaultAccentBlueColor]; 38 | self.doneBarButtonItemTintColor = [self iOS7DefaultAccentBlueColor]; 39 | self.navigationBarTintColor = [self iOS7DefaultAccentBlueColor]; 40 | self.navigationBarBarTintColor = [UIColor whiteColor]; 41 | self.navigationBarTranslucent = NO; 42 | self.barButtonItemsUIFont = [UIFont systemFontOfSize:15]; 43 | self.veeContactEmptyViewLabelFont = [UIFont systemFontOfSize:15]; 44 | self.veeContactEmptyViewLabelTextColor = [UIColor blackColor]; 45 | self.veeContactPickerTableViewBottomMargin = 0; 46 | } 47 | 48 | - (void)loadVeeContactTableViewCellDefaultConstants 49 | { 50 | self.veeContactCellImageDiameter = @(50.0); 51 | self.veeContactCellPrimaryLabelFont = [UIFont systemFontOfSize:17]; 52 | self.veeContactCellBackgroundColor = [UIColor whiteColor]; 53 | self.veeContactCellBackgroundColorWhenSelected = [UIColor lightGrayColor]; 54 | } 55 | 56 | 57 | -(UIColor*)iOS7DefaultAccentBlueColor 58 | { 59 | return [UIColor colorWithRed:0.0 green:122.0/255.0 blue:1.0 alpha:1.0]; 60 | } 61 | 62 | @end 63 | 64 | NS_ASSUME_NONNULL_END 65 | -------------------------------------------------------------------------------- /VeeContactPicker/Classes/Model/ContactPicker/VeeContactPickerOptions.h: -------------------------------------------------------------------------------- 1 | @import Foundation; 2 | @import UIKit; 3 | @class VeeContactPickerStrings; 4 | 5 | NS_ASSUME_NONNULL_BEGIN 6 | 7 | @interface VeeContactPickerOptions : NSObject 8 | 9 | #pragma mark - Init 10 | 11 | - (instancetype)initWithDefaultOptions NS_DESIGNATED_INITIALIZER; 12 | + (VeeContactPickerOptions*)defaultOptions; 13 | 14 | @property (nonatomic, strong) VeeContactPickerStrings *veeContactPickerStrings; 15 | @property (nonatomic, strong) NSArray *sectionIdentifiers; //Contacts section identifiers, default are [[[UILocalizedIndexedCollation currentCollation] sectionIndexTitles] 16 | @property (nonatomic, copy) NSString *sectionIdentifierWildcard; //Section identifier for contacts that don't fit in a section, default is '#' as in the iOS address book 17 | @property (nonatomic, assign) BOOL showInitialsPlaceholder; //Default value is YES 18 | @property (nonatomic, strong) UIImage *contactThumbnailImagePlaceholder; //The placeholder image that is shown when showInitialsPlaceholder is NO and the contact doesn't have an image 19 | 20 | @end 21 | 22 | NS_ASSUME_NONNULL_END 23 | -------------------------------------------------------------------------------- /VeeContactPicker/Classes/Model/ContactPicker/VeeContactPickerOptions.m: -------------------------------------------------------------------------------- 1 | #import "VeeContactPickerOptions.h" 2 | #import "VeeContactPickerStrings.h" 3 | 4 | NS_ASSUME_NONNULL_BEGIN 5 | 6 | @implementation VeeContactPickerOptions 7 | 8 | #pragma mark - Init 9 | 10 | - (instancetype)init 11 | { 12 | self = [self initWithDefaultOptions]; 13 | return self; 14 | } 15 | 16 | - (instancetype)initWithDefaultOptions 17 | { 18 | if (self = [super init]) { 19 | _veeContactPickerStrings = [VeeContactPickerStrings defaultStrings]; 20 | _sectionIdentifiers = [UILocalizedIndexedCollation currentCollation].sectionIndexTitles; 21 | _sectionIdentifierWildcard = @"#"; 22 | _showInitialsPlaceholder = YES; 23 | _contactThumbnailImagePlaceholder = nil; 24 | } 25 | return self; 26 | } 27 | 28 | + (VeeContactPickerOptions*)defaultOptions 29 | { 30 | VeeContactPickerOptions* veeContactPickerOptions = [[self alloc] initWithDefaultOptions]; 31 | return veeContactPickerOptions; 32 | } 33 | 34 | @end 35 | 36 | NS_ASSUME_NONNULL_END 37 | -------------------------------------------------------------------------------- /VeeContactPicker/Classes/Model/ContactPicker/VeeContactPickerStrings.h: -------------------------------------------------------------------------------- 1 | @import Foundation; 2 | 3 | NS_ASSUME_NONNULL_BEGIN 4 | 5 | @interface VeeContactPickerStrings : NSObject 6 | 7 | - (instancetype)init NS_UNAVAILABLE; 8 | - (instancetype)initWithDefaultStrings; 9 | - (instancetype)initWithNavigationBarTitle:(NSString *)navigationBarTitle 10 | cancelButtonTitle:(NSString *)cancelButtonTitle 11 | emptyViewLabelText:(NSString *)emptyViewLabelText; 12 | - (instancetype)initWithNavigationBarTitle:(NSString *)navigationBarTitle 13 | cancelButtonTitle:(NSString *)cancelButtonTitle 14 | emptyViewLabelText:(NSString *)emptyViewLabelText 15 | doneButtonTitle:(NSString *)doneButtonTitle; 16 | 17 | + (VeeContactPickerStrings *)defaultStrings; 18 | 19 | @property (nonatomic, strong) NSString *navigationBarTitle; 20 | @property (nonatomic, strong) NSString *navigationBarTitleForMultipleContacts; 21 | @property (nonatomic, strong) NSString *cancelButtonTitle; 22 | @property (nonatomic, strong) NSString *doneButtonTitle; 23 | @property (nonatomic, strong) NSString *searchBarPlaceholder; 24 | @property (nonatomic, strong) NSString *emptyViewLabelText; 25 | 26 | @end 27 | 28 | NS_ASSUME_NONNULL_END 29 | -------------------------------------------------------------------------------- /VeeContactPicker/Classes/Model/ContactPicker/VeeContactPickerStrings.m: -------------------------------------------------------------------------------- 1 | #import "VeeContactPickerStrings.h" 2 | 3 | NS_ASSUME_NONNULL_BEGIN 4 | 5 | @implementation VeeContactPickerStrings 6 | 7 | - (instancetype)initWithDefaultStrings 8 | { 9 | return [self initWithNavigationBarTitle:@"Choose a contact" 10 | cancelButtonTitle:@"Cancel" 11 | emptyViewLabelText:@"There are no contacts to display" 12 | doneButtonTitle:@"Done"]; 13 | } 14 | 15 | + (VeeContactPickerStrings*)defaultStrings 16 | { 17 | VeeContactPickerStrings *veeContactPickerDefaultStrings = [[VeeContactPickerStrings alloc] initWithDefaultStrings]; 18 | return veeContactPickerDefaultStrings; 19 | } 20 | 21 | - (instancetype)initWithNavigationBarTitle:(NSString *)navigationBarTitle 22 | cancelButtonTitle:(NSString *)cancelButtonTitle 23 | emptyViewLabelText:(NSString *)emptyViewLabelText { 24 | return [self initWithNavigationBarTitle:navigationBarTitle 25 | cancelButtonTitle:cancelButtonTitle 26 | emptyViewLabelText:emptyViewLabelText]; 27 | } 28 | 29 | - (instancetype)initWithNavigationBarTitle:(NSString *)navigationBarTitle 30 | cancelButtonTitle:(NSString *)cancelButtonTitle 31 | emptyViewLabelText:(NSString *)emptyViewLabelText 32 | doneButtonTitle:(NSString *)doneButtonTitle { 33 | self = [super init]; 34 | if (self) { 35 | _doneButtonTitle = doneButtonTitle; 36 | _navigationBarTitle = navigationBarTitle; 37 | _cancelButtonTitle = cancelButtonTitle; 38 | _emptyViewLabelText = emptyViewLabelText; 39 | _searchBarPlaceholder = @"Search"; 40 | _navigationBarTitleForMultipleContacts = @"Choose a contact"; 41 | } 42 | return self; 43 | } 44 | 45 | @end 46 | 47 | NS_ASSUME_NONNULL_END 48 | -------------------------------------------------------------------------------- /VeeContactPicker/Classes/Model/VeeABRecord.h: -------------------------------------------------------------------------------- 1 | @import AddressBook; 2 | @import UIKit; 3 | @import Foundation; 4 | 5 | NS_ASSUME_NONNULL_BEGIN 6 | 7 | @interface VeeABRecord : NSObject 8 | 9 | - (instancetype)init NS_UNAVAILABLE; 10 | - (instancetype)initWithLinkedPeopleOfABRecord:(ABRecordRef)abRecordRef NS_DESIGNATED_INITIALIZER; 11 | 12 | @property (nonatomic, readonly, strong) NSArray *recordIds; 13 | @property (nonatomic, readonly, strong) NSDate *modifiedAt; 14 | @property (nonatomic, readonly, strong) NSDate *createdAt; 15 | @property (nonatomic, readonly, copy) NSString *firstName; 16 | @property (nonatomic, readonly, copy) NSString *lastName; 17 | @property (nonatomic, readonly, copy) NSString *middleName; 18 | @property (nonatomic, readonly, copy) NSString *nickname; 19 | @property (nonatomic, readonly, copy) NSString *organizationName; 20 | @property (nonatomic, readonly, copy) NSString *compositeName; 21 | @property (nonatomic, readonly, strong) UIImage *thumbnailImage; 22 | @property (nonatomic, readonly, strong) NSArray *phoneNumbers; 23 | @property (nonatomic, readonly, strong) NSArray *emails; 24 | @property (nonatomic, readonly, strong) NSArray *postalAddresses; 25 | @property (nonatomic, readonly, strong) NSArray *websites; 26 | @property (nonatomic, readonly, strong) NSArray *facebookAccounts; 27 | @property (nonatomic, readonly, strong) NSArray *twitterAccounts; 28 | 29 | #pragma mark - Postal address constants 30 | 31 | extern NSString* const kVeePostalAddressStreetKey; 32 | extern NSString* const kVeePostalAddressCityKey; 33 | extern NSString* const kVeePostalAddressStateKey; 34 | extern NSString* const kVeePostalAddressPostalCodeKey; 35 | extern NSString* const kVeePostalAddressCountryKey; 36 | 37 | @end 38 | 39 | NS_ASSUME_NONNULL_END 40 | -------------------------------------------------------------------------------- /VeeContactPicker/Classes/Model/VeeContact Abstract Factory/VeeContactFactory.h: -------------------------------------------------------------------------------- 1 | @import Foundation; 2 | @import AddressBook; 3 | #import "VeeContactFactoryProt.h" 4 | #import "VeeContactProt.h" 5 | 6 | NS_ASSUME_NONNULL_BEGIN 7 | 8 | @interface VeeContactFactory : NSObject 9 | + (NSArray >*)veeContactProtsFromAddressBook:(ABAddressBookRef)addressBook; 10 | @end 11 | 12 | NS_ASSUME_NONNULL_END 13 | -------------------------------------------------------------------------------- /VeeContactPicker/Classes/Model/VeeContact Abstract Factory/VeeContactFactory.m: -------------------------------------------------------------------------------- 1 | #import "VeeContactFactory.h" 2 | #import "VeeABRecordsImporter.h" 3 | #import "VeeABRecord.h" 4 | #import "VeeContact.h" 5 | 6 | NS_ASSUME_NONNULL_BEGIN 7 | 8 | @implementation VeeContactFactory 9 | 10 | +(NSArray>*)veeContactProtsFromAddressBook:(ABAddressBookRef)addressBook 11 | { 12 | VeeABRecordsImporter* abRepositoryImporter = [VeeABRecordsImporter new]; 13 | NSArray* veeABRecords = [abRepositoryImporter importVeeABRecordsFromAddressBook:addressBook]; 14 | NSMutableArray* veeContacts = [NSMutableArray new]; 15 | for (VeeABRecord* veeABRecord in veeABRecords){ 16 | id veeContact = [[VeeContact alloc] initWithVeeABRecord:veeABRecord]; 17 | [veeContacts addObject:veeContact]; 18 | } 19 | return [NSArray arrayWithArray:veeContacts]; 20 | } 21 | 22 | @end 23 | 24 | NS_ASSUME_NONNULL_END 25 | -------------------------------------------------------------------------------- /VeeContactPicker/Classes/Model/VeeContact Abstract Factory/VeeContactFactoryProt.h: -------------------------------------------------------------------------------- 1 | @import Foundation; 2 | @import AddressBook; 3 | #import "VeeContactProt.h" 4 | 5 | NS_ASSUME_NONNULL_BEGIN 6 | 7 | @protocol VeeContactFactoryProt 8 | + (NSArray>*)veeContactProtsFromAddressBook:(ABAddressBookRef)addressBook; 9 | @end 10 | 11 | NS_ASSUME_NONNULL_END 12 | -------------------------------------------------------------------------------- /VeeContactPicker/Classes/Model/VeeContact Abstract Factory/VeeContactProtFactoryProducer.h: -------------------------------------------------------------------------------- 1 | @import Foundation; 2 | #import "VeeContactFactoryProt.h" 3 | 4 | NS_ASSUME_NONNULL_BEGIN 5 | 6 | @interface VeeContactProtFactoryProducer : NSObject 7 | + (id)veeContactProtFactory; 8 | @end 9 | 10 | NS_ASSUME_NONNULL_END 11 | -------------------------------------------------------------------------------- /VeeContactPicker/Classes/Model/VeeContact Abstract Factory/VeeContactProtFactoryProducer.m: -------------------------------------------------------------------------------- 1 | #import "VeeContactProtFactoryProducer.h" 2 | #import "VeeContactFactory.h" 3 | 4 | NS_ASSUME_NONNULL_BEGIN 5 | 6 | @implementation VeeContactProtFactoryProducer 7 | 8 | + (id)veeContactProtFactory 9 | { 10 | VeeContactFactory* veeContactFactory = [VeeContactFactory new]; 11 | return veeContactFactory; 12 | } 13 | 14 | @end 15 | 16 | NS_ASSUME_NONNULL_END 17 | -------------------------------------------------------------------------------- /VeeContactPicker/Classes/Model/VeeContact.h: -------------------------------------------------------------------------------- 1 | @import Foundation; 2 | @import UIKit; 3 | #import "VeeContactProt.h" 4 | #import "VeePostalAddressProt.h" 5 | @class VeeABRecord; 6 | 7 | @interface VeeContact : NSObject 8 | 9 | #pragma mark - Init 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | - (instancetype)init NS_UNAVAILABLE; 14 | - (instancetype)initWithVeeABRecord:(VeeABRecord*)veeABRecord; 15 | - (instancetype)initWithFirstName:(nullable NSString*)firstName middleName:(nullable NSString*)middleName lastName:(nullable NSString*)lastName nickName:(nullable NSString*)nickName organizationName:(nullable NSString*)organizationName compositeName:(nullable NSString*)compositeName thubnailImage:(nullable UIImage*)thumbnailImage phoneNumbers:(nullable NSArray*)phoneNumbers emails:(nullable NSArray*)emails; 16 | 17 | #pragma mark - Readonly 18 | 19 | @property (nonatomic, readonly, strong) NSArray* recordIds; 20 | 21 | #pragma mark - Single value properties 22 | 23 | @property (nonatomic, copy) NSString* firstName; 24 | @property (nonatomic, copy) NSString* lastName; 25 | @property (nonatomic, copy) NSString* middleName; 26 | @property (nonatomic, copy) NSString* nickname; 27 | @property (nonatomic, copy) NSString* organizationName; 28 | @property (nonatomic, copy) NSString* compositeName; //Prefix, Suffix, Organization, First name, and Last name. 29 | @property (nonatomic, strong) UIImage* thumbnailImage; 30 | 31 | #pragma mark - Multivalue properties 32 | 33 | @property (nonatomic, strong) NSArray* phoneNumbers; 34 | @property (nonatomic, strong) NSArray* emails; 35 | @property (nonatomic, strong) NSArray >* postalAddresses; 36 | @property (nonatomic, strong) NSArray* twitterAccounts; 37 | @property (nonatomic, strong) NSArray* facebookAccounts; 38 | 39 | #pragma mark - Getters 40 | 41 | @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSString * _Nonnull displayName; // It's based on non-empty fields of the contact: "FirstName LastName" - "OrganizationName" - "LastName" - "First Name" - "Middle Name" - "Nickname" - "emailAddress[0]" 42 | @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSString * _Nonnull displayNameSortedForABOptions; //Display name is sorted considering the sort-ordering preference in the address book. See ABPersonGetSortOrdering() 43 | @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSString * _Nonnull sectionIdentifier; 44 | 45 | #pragma mark - Search predicate 46 | 47 | + (NSPredicate*)searchPredicateForSearchString; //$searchString is used for substitution. Default predicate is: @"displayName contains[c] $searchString || ANY emails contains[c] $searchString || ANY phoneNumbers contains[c] $searchString" 48 | ; 49 | 50 | @end 51 | 52 | NS_ASSUME_NONNULL_END 53 | -------------------------------------------------------------------------------- /VeeContactPicker/Classes/Model/VeeContactProt.h: -------------------------------------------------------------------------------- 1 | @import Foundation; 2 | @import UIKit; 3 | #import "VeePostalAddressProt.h" 4 | #import "VeeSectionable.h" 5 | 6 | @protocol VeeContactProt 7 | 8 | @property (nonatomic, copy) NSString* firstName; 9 | @property (nonatomic, copy) NSString* lastName; 10 | @property (nonatomic, copy) NSString* middleName; 11 | @property (nonatomic, copy) NSString* nickname; 12 | @property (nonatomic, copy) NSString* organizationName; 13 | @property (nonatomic, copy) NSString* compositeName; 14 | @property (nonatomic, strong) UIImage* thumbnailImage; 15 | 16 | @property (nonatomic, strong) NSArray* phoneNumbers; 17 | @property (nonatomic, strong) NSArray* emails; 18 | 19 | @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSString *displayName; 20 | @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSString *displayNameSortedForABOptions; 21 | @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSString *sectionIdentifier; 22 | 23 | + (NSPredicate*)searchPredicateForSearchString; 24 | 25 | @optional 26 | 27 | @property (nonatomic, readonly, strong) NSArray* recordIds; 28 | @property (nonatomic, strong) NSArray >* postalAddresses; 29 | @property (nonatomic, strong) NSArray* twitterAccounts; 30 | @property (nonatomic, strong) NSArray* facebookAccounts; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /VeeContactPicker/Classes/Model/VeePostalAddress.h: -------------------------------------------------------------------------------- 1 | @import Foundation; 2 | #import "VeePostalAddressProt.h" 3 | 4 | NS_ASSUME_NONNULL_BEGIN 5 | 6 | @interface VeePostalAddress : NSObject 7 | 8 | - (instancetype)init NS_UNAVAILABLE; 9 | -(instancetype)initWithStreet:(nullable NSString*)street city:(nullable NSString*)city state:(nullable NSString*)state postal:(nullable NSString*)postal country:(nullable NSString*)country; 10 | 11 | @property (nonatomic, copy) NSString * street; 12 | @property (nonatomic, copy) NSString * city; 13 | @property (nonatomic, copy) NSString * state; 14 | @property (nonatomic, copy) NSString * postal; 15 | @property (nonatomic, copy) NSString * country; 16 | 17 | @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSString * _Nonnull unifiedAddress; 18 | 19 | @end 20 | 21 | NS_ASSUME_NONNULL_END 22 | -------------------------------------------------------------------------------- /VeeContactPicker/Classes/Model/VeePostalAddress.m: -------------------------------------------------------------------------------- 1 | #import "VeePostalAddress.h" 2 | 3 | NS_ASSUME_NONNULL_BEGIN 4 | 5 | @implementation VeePostalAddress 6 | 7 | -(instancetype)initWithStreet:(nullable NSString*)street city:(nullable NSString*)city state:(nullable NSString*)state postal:(nullable NSString*)postal country:(nullable NSString*)country 8 | { 9 | self = [super init]; 10 | if (!self) { 11 | return nil; 12 | } 13 | 14 | _street = street; 15 | _city = city; 16 | _state = state; 17 | _postal = postal; 18 | _country = country; 19 | return self; 20 | } 21 | 22 | #pragma mark - Public methods 23 | 24 | -(NSString*)unifiedAddress 25 | { 26 | NSString* unifiedAddress = @""; 27 | NSArray* sortedAddressProperties = [self sortedAddressProperties]; 28 | 29 | for (int i = 0; i < sortedAddressProperties.count; i++) { 30 | unifiedAddress = [unifiedAddress stringByAppendingString:sortedAddressProperties[i]]; 31 | if (i != sortedAddressProperties.count - 1) { 32 | unifiedAddress = [unifiedAddress stringByAppendingString:@", "]; 33 | } 34 | } 35 | return unifiedAddress; 36 | } 37 | 38 | #pragma mark - Private utils 39 | 40 | -(NSArray*)sortedAddressProperties 41 | { 42 | NSMutableArray* sortedAddressPropertiesMutable = [NSMutableArray new]; 43 | 44 | if (_street) { 45 | [sortedAddressPropertiesMutable addObject:_street]; 46 | } 47 | if (_city) { 48 | [sortedAddressPropertiesMutable addObject:_city]; 49 | } 50 | if (_state) { 51 | [sortedAddressPropertiesMutable addObject:_state]; 52 | } 53 | if (_postal) { 54 | [sortedAddressPropertiesMutable addObject:_postal]; 55 | } 56 | if (_country) { 57 | [sortedAddressPropertiesMutable addObject:_country]; 58 | } 59 | return [NSArray arrayWithArray:sortedAddressPropertiesMutable]; 60 | } 61 | 62 | #pragma mark - NSObject 63 | 64 | -(NSString*)description 65 | { 66 | return [self unifiedAddress]; 67 | } 68 | 69 | @end 70 | 71 | NS_ASSUME_NONNULL_END 72 | -------------------------------------------------------------------------------- /VeeContactPicker/Classes/Model/VeePostalAddressProt.h: -------------------------------------------------------------------------------- 1 | @import Foundation; 2 | 3 | NS_ASSUME_NONNULL_BEGIN 4 | 5 | @protocol VeePostalAddressProt 6 | 7 | @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSString * _Nonnull street; 8 | @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSString * _Nonnull city; 9 | @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSString * _Nonnull state; 10 | @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSString * _Nonnull postal; 11 | @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSString * _Nonnull country; 12 | @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSString * _Nonnull unifiedAddress; 13 | 14 | @end 15 | 16 | NS_ASSUME_NONNULL_END 17 | -------------------------------------------------------------------------------- /VeeContactPicker/Classes/Model/VeeSectionable.h: -------------------------------------------------------------------------------- 1 | @import Foundation; 2 | 3 | NS_ASSUME_NONNULL_BEGIN 4 | 5 | @protocol VeeSectionableProt 6 | @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSString * _Nonnull sectionIdentifier; 7 | @end 8 | 9 | NS_ASSUME_NONNULL_END 10 | -------------------------------------------------------------------------------- /VeeContactPicker/Classes/Utils and categories/NSBundle+VeeContactPicker.h: -------------------------------------------------------------------------------- 1 | @import Foundation; 2 | 3 | @interface NSBundle (VeeContactPicker) 4 | + (NSBundle *)veeContactPickerBundle; 5 | @end 6 | -------------------------------------------------------------------------------- /VeeContactPicker/Classes/Utils and categories/NSBundle+VeeContactPicker.m: -------------------------------------------------------------------------------- 1 | #import "NSBundle+VeeContactPicker.h" 2 | #import "VeeCommons.h" 3 | 4 | @implementation NSBundle (VeeContactPicker) 5 | 6 | + (NSBundle *)veeContactPickerBundle { 7 | return [NSBundle bundleForClass:VeeCommons.class]; 8 | } 9 | 10 | @end 11 | -------------------------------------------------------------------------------- /VeeContactPicker/Classes/Utils and categories/NSObject+VeeCommons.h: -------------------------------------------------------------------------------- 1 | @import Foundation; 2 | 3 | NS_ASSUME_NONNULL_BEGIN 4 | 5 | @interface NSObject (VeeCommons) 6 | 7 | - (NSString*)vee_formattedDescriptionOfProperty:(id)property; 8 | - (NSString*)vee_formattedDescriptionOfArray:(NSArray*)array; 9 | 10 | @end 11 | 12 | NS_ASSUME_NONNULL_END 13 | -------------------------------------------------------------------------------- /VeeContactPicker/Classes/Utils and categories/NSObject+VeeCommons.m: -------------------------------------------------------------------------------- 1 | #import "NSObject+VeeCommons.h" 2 | 3 | NS_ASSUME_NONNULL_BEGIN 4 | 5 | @implementation NSObject (VeeCommons) 6 | 7 | - (NSString*)vee_formattedDescriptionOfProperty:(id)property 8 | { 9 | if (property == nil){ 10 | return @"nil"; 11 | } 12 | return property; 13 | } 14 | 15 | - (NSString*)vee_formattedDescriptionOfArray:(NSArray*)array 16 | { 17 | if (array == nil || array.count == 0) { 18 | return @"[]"; 19 | } 20 | NSMutableString* arrayDescriptionMutable = [[NSMutableString alloc] initWithString:@"["]; 21 | for (id obj in array) { 22 | [arrayDescriptionMutable appendString:[NSString stringWithFormat:@"%@", [obj description]]]; 23 | BOOL isNotLastObject = [obj isEqual:array.lastObject] == NO; 24 | if (isNotLastObject) { 25 | [arrayDescriptionMutable appendString:@"; "]; 26 | } 27 | else { 28 | [arrayDescriptionMutable appendString:@"]"]; 29 | } 30 | } 31 | return [NSString stringWithString:arrayDescriptionMutable]; 32 | } 33 | 34 | @end 35 | 36 | NS_ASSUME_NONNULL_END 37 | -------------------------------------------------------------------------------- /VeeContactPicker/Classes/Utils and categories/UILabel+VeeBoldify.h: -------------------------------------------------------------------------------- 1 | NS_ASSUME_NONNULL_BEGIN 2 | 3 | @import UIKit; 4 | 5 | @interface UILabel (VeeBoldify) 6 | 7 | - (void)vee_boldSubstring:(NSString*)substring; 8 | - (void)vee_boldRange:(NSRange)range; 9 | 10 | @end 11 | 12 | NS_ASSUME_NONNULL_END 13 | -------------------------------------------------------------------------------- /VeeContactPicker/Classes/Utils and categories/UILabel+VeeBoldify.m: -------------------------------------------------------------------------------- 1 | #import "UILabel+VeeBoldify.h" 2 | 3 | NS_ASSUME_NONNULL_BEGIN 4 | 5 | @implementation UILabel (VeeBoldify) 6 | 7 | - (void)vee_boldRange:(NSRange)range 8 | { 9 | if (![self respondsToSelector:@selector(setAttributedText:)]) { 10 | return; 11 | } 12 | NSMutableAttributedString* attributedText = [[NSMutableAttributedString alloc] initWithAttributedString:self.attributedText]; 13 | [attributedText setAttributes:@{ NSFontAttributeName : [UIFont boldSystemFontOfSize:self.font.pointSize] } range:range]; 14 | self.attributedText = attributedText; 15 | } 16 | 17 | - (void)vee_boldSubstring:(NSString*)substring 18 | { 19 | NSRange range = [self.text rangeOfString:substring]; 20 | [self vee_boldRange:range]; 21 | } 22 | 23 | @end 24 | 25 | NS_ASSUME_NONNULL_END 26 | -------------------------------------------------------------------------------- /VeeContactPicker/Classes/Utils and categories/VeeCommons.h: -------------------------------------------------------------------------------- 1 | @import Foundation; 2 | 3 | NS_ASSUME_NONNULL_BEGIN 4 | 5 | @interface VeeCommons : NSObject 6 | 7 | + (BOOL)vee_isEmpty:(id)obj; 8 | + (BOOL)vee_isNotEmpty:(id)obj; 9 | 10 | @end 11 | 12 | NS_ASSUME_NONNULL_END 13 | -------------------------------------------------------------------------------- /VeeContactPicker/Classes/Utils and categories/VeeCommons.m: -------------------------------------------------------------------------------- 1 | #import "VeeCommons.h" 2 | 3 | NS_ASSUME_NONNULL_BEGIN 4 | 5 | @implementation VeeCommons 6 | 7 | + (BOOL)vee_isEmpty:(id)obj 8 | { 9 | return obj == nil 10 | || [obj isKindOfClass:[NSNull class]] 11 | || ([obj respondsToSelector:@selector(length)] 12 | && [obj length] == 0) 13 | || ([obj respondsToSelector:@selector(count)] 14 | && [obj count] == 0); 15 | } 16 | 17 | + (BOOL)vee_isNotEmpty:(id)obj 18 | { 19 | return [self vee_isEmpty:obj] == NO; 20 | } 21 | 22 | @end 23 | 24 | NS_ASSUME_NONNULL_END 25 | -------------------------------------------------------------------------------- /_Pods.xcodeproj: -------------------------------------------------------------------------------- 1 | Example/Pods/Pods.xcodeproj --------------------------------------------------------------------------------