Issue #249

Making splash screen with LaunchScreen.storyboard is now the default way to do in iOS. Testing it with UITests is a bit tricky as this screen is showed the system, and if we test that, we are just testing the system.

What we should test is the content we put in the LaunchScreen storyboard. Is it showing correctly on different screen sizes? Is it missing any texts or images?

One way to test that is via Unit Test. LaunchScreen storyboard always come with 1 UIViewController configured as an initial view controller

class LauncScreenTests: XCTestCase {
    func testLaunchScreen() {
        let launchScreen = UIStoryboard(name: "LaunchScreen", bundle: nil)
        let viewController = launchScreen.instantiateInitialViewController()!

        let label = viewController.view.subviews.compactMap({ $0 as? UILabel }).first!
        XCTAssertEqual(label.text, "Welcome to my app")

        let imageView = viewController.view.subviews.compactMap({ $0 as? UIImageView }).first!
        XCTAssertNotNil(imageView.image)
    }
}