

Whether it is above or below all the other Xcode groups does not matter. It should appear nested underneath your application's blue project icon. Open the new Mocker folder, and drag the Mocker.xcodeproj into the Project Navigator of your application's Xcode project. Open up Terminal, cd into your top-level project directory, and run the following command "if" your project is not initialized as a git repository: If you prefer not to use any of the aforementioned dependency managers, you can integrate Mocker into your project manually. If you get the following error: cannot find auto-link library XCTest and XCTestSwiftSupport, set the following property under Build Options from No to Yes.ĮNABLE_TESTING_SEARCH_PATHS to YES Manually To add Mocker as a dependency to your Xcode project, select File > Swift Packages > Add Package Dependency and enter the repository URL. Import PackageDescription let package = Package( To make it work with your custom URLSession, the MockingURLProtocol needs to be registered: The mocker will automatically be activated for the default URL loading system like URLSession.shared after you've registered your first Mock. Unit tests are written for the Mocker which can help you to see how it works. Supports popular frameworks like Alamofire.Works with URLSession using a custom protocol class.Create mocked data requests based on a file extension.Create mocked data requests based on an URL.

Run all your data request unit tests offline 🎉 Mocker is a library written in Swift which makes it possible to mock data requests using a custom URLProtocol.
