harryfeng
harryfeng

Reputation: 573

iOS Automatically click and go to certain view controller

So I built my iOS app completely using code(built all interface programmatically). The app is pretty huge and every time I start the app, I need to click 3 or 4 times to go to certain view controller to see the effects.

Is there a way to auto this process?

So when I start the app, it will auto click button/table cell and go to certain view controller.

I can't set the initial view controller differently because I need to pass data from the beginning to the controller I want to see.

Thanks for help.

Upvotes: 0

Views: 1572

Answers (2)

davidv
davidv

Reputation: 383

You can use XCTest framework to create automated test. You simply need to add new target in your projects settings. Then create a test case for any walkthrough of your application. The advantage is, after you change any part of your application, you can simply rerun the tests to see that you didn't break anything.

Xcode even has an option to record the tests, so you don't need to program it completely by hand.

Apples guide to UI testing: https://developer.apple.com/library/content/documentation/DeveloperTools/Conceptual/testing_with_xcode/chapters/09-ui_testing.html

How to record UI tests: https://developer.apple.com/library/content/documentation/ToolsLanguages/Conceptual/Xcode_Overview/RecordingUITests.html

Upvotes: 1

shuvo
shuvo

Reputation: 705

You can use delegate pattern or blocks to wait until you get the data, then call your methods (If you know the button/ table cell indexpath) to go to your destination with the data. You can do the whole process programmatically.

Upvotes: 0

Related Questions