kbokdia
kbokdia

Reputation: 459

How to change Status Bar Style of PushRow View Controller?

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)"

Upvotes: 0

Views: 307

Answers (2)

A. Aleshkevich
A. Aleshkevich

Reputation: 1

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
  }
}

Upvotes: 0

dduyduong
dduyduong

Reputation: 122

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>

Upvotes: 0

Related Questions