You can find an iOS implementation of Mockturtle including Unit- and UI-Tests in Example/macOS-iOS/MockturtleExample
You can almost let Alamofire do the job of mapping state identifiers for specific routes.
- Define your scenarios as shown in Docs/scenarios.md
- Switch to the scenarios folder
cd scenarios
- Run
mockturtle generate
to generate theoutput.json
Drag and Drop output.json
into your Xcode project or go to File > Add Files to "Your Project" and select your output.json
.
You don't have to check Copy items if needed
. When you let this checkbox unselected, you can update your output.json
all the time and it stays fresh in your Xcode project aswell.
From now on your can access your output.json
via
Bundle.main.url(forResource: "output", withExtension: "json")
Cartfile
github "Alamofire/Alamofire" ~> 4.8.1
github "thepeaklab/mockturtle-ios" ~> 0.1.0
let sessionManager = SessionManager.default
sessionManager.adapter = MockturtleRequestAdapter("the_scenario_you_want_to_mock")
sessionManager.request("<your url>").responseData { response in
// to something
}
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsLocalNetworking</key>
<true/>
</dict>
see Apple Documentation - CocoaKeys
If set to YES
, allows loading of local resources without disabling ATS for the rest of your app. Default value is NO.