0

I have got the answer if I am using latest pod of Eureka which supports swift 4. https://github.com/xmartlabs/Eureka/issues/1355#issuecomment-353334726

But I am on branch swift 3.2

When I use the solution given in the above link

class MyPushViewController: SelectorViewController<SelectorRow<PushSelectorCell<String>>> {

    override var preferredStatusBarStyle: UIStatusBarStyle {
        return .lightContent
    }
}

I get error "Generic type 'SelectorRow' specialized with too few type parameters (got 1, but expected 2)"

kbokdia
  • 439
  • 5
  • 11

2 Answers2

0

The error you got is about SelectRow generic type. It required 2 type parameters:

<SelectRow<PushSeletorCell<String>, second type here>

Example from Eureka:

public final class CustomPushRow<T: Equatable>: SelectorRow<PushSelectorCell<T>, SelectorViewController<T>>, RowType { 
    public required init(tag: String?) { 
        super.init(tag: tag) 
        presentationMode = .show(controllerProvider: ControllerProvider.callback { 
            return SelectorViewController<T>(){ _ in } 
        }, onDismiss: { vc in 
            _ = vc.navigationController?.popViewController(animated: true) 
        }) 
    } 
}

As you can see, SelectRow required 2 type params: PushSelectorCell<T> and SelectorViewController<T>

dduyduong
  • 124
  • 1
  • 5
  • I did not understand. Can you be more explicit? Like what should the second type be? – kbokdia Dec 27 '17 at 23:16
  • i am not able to access preferredStatusBarStyle inside this class CustomPushRow – kbokdia Dec 27 '17 at 23:31
  • 1
    prefferedStatusBarStyle is UIViewController property. You should subclass SelectorViewController and access preffredStatusBarStyle. Therefore the second type param should be your subclass name. You can also replace generic T above with String – dduyduong Dec 27 '17 at 23:38
0

I tried to get custom rows working but after almost 2 hours of experiments I've achieved nothing. Random template errors, it reminded me template hell from cpp.

Here is a workaround for tired people like me:

class CustomNavigationController: UINavigationController {
  override var preferredStatusBarStyle: UIStatusBarStyle {
    // force status bar style for Eureka forms
    if topViewController is FormViewController {
      return .lightContent
    }
    return topViewController?.preferredStatusBarStyle ?? .default
  }
}