Page MenuHomePhabricator

Remove "wmf_initialViewControllerFromClassStoryboard"
Closed, InvalidPublic

Description

This method allows VCs to be instantiated while breaking nullability rules or circumventing class initializers. Using this method will silently fail if your VC is not properly configured.

Replace this with class methods on each view controllers to instantiate them.

Event Timeline

Fjalapeno raised the priority of this task from to Needs Triage.
Fjalapeno updated the task description. (Show Details)
Fjalapeno subscribed.

This method allows VCs to be instantiated while breaking nullability rules or circumventing class initializers

How does it break nullability rules? Also, using storyboards circumvents class initializers by definition (since you're implicitly using initWithCoder:).

Also, the method already asserts if anything is not configured properly. If we're worried about early feedback on misconfigured/misnamed things in storyboards, we can easily build a reusable test harness which validates that specific view controller classes can be instantiated this way w/o issue:

- (void)testStoryboardFactoryMethod {
  for (Class c in @[WMFArticleViewController, ...]) {
    UIViewController* vc;
    XCTAssertNoThrow(vc = [c wmf_initialViewControllerFromClassStoryboard]); // catch assertions
    XCTAssertNotNil(vc)
  }
}

I think we should use this more, not remove it.

LGoto subscribed.

Closed in iOS board grooming.