kitasuke / PagingMenuController

Paging view controller with customizable menu in Swift
MIT License
2.5k stars 449 forks source link

How can we add view controller via storyBoard? #329

Closed kishor010 closed 7 years ago

kishor010 commented 7 years ago

I am new in swift, I want to know that how can I add both view controller by storyboard ID.? @newbdez33 @wwwjfy @patricks Here it is added by programmatically.

private struct PagingMenuOptions: PagingMenuControllerCustomizable {
private let viewController1 = ViewController1() //Added View controller by programmatically. 
private let viewController2 = ViewController2()

fileprivate var componentType: ComponentType {
    return .all(menuOptions: MenuOptions(), pagingControllers: pagingControllers)
}

fileprivate var pagingControllers: [UIViewController] {
    return [viewController1, viewController2]
}

fileprivate struct MenuOptions: MenuViewCustomizable {
    var displayMode: MenuDisplayMode {
        return .segmentedControl
    }
    var itemsOptions: [MenuItemViewCustomizable] {
        return [MenuItem1(), MenuItem2()]
    }

    var backgroundColor : UIColor {
        return UIColor.blue
    }

    var focusMode: MenuFocusMode {
        return .underline(height: 4, color: UIColor.black, horizontalPadding: 10, verticalPadding: 0)
    }
}

fileprivate struct MenuItem1: MenuItemViewCustomizable {
    var displayMode: MenuItemDisplayMode {
        return .text(title: MenuItemText(text: "First Menu",color: UIColor.lightGray,
                     selectedColor: UIColor.blue))
    }
}
fileprivate struct MenuItem2: MenuItemViewCustomizable {
    var displayMode: MenuItemDisplayMode {
        return .text(title: MenuItemText(text: "Second Menu"))
    }
}
}
wwwjfy commented 7 years ago

@kishor010 I think a better place to ask questions is stackoverflow, instead of issues page of the repository. Also, the owner will get notifications, no need to @ people specifically. PS, I committed a PR once, but I see no point this is related to me. Thanks~

kitasuke commented 7 years ago

Can you take a look at example project? It generates view controllers via storyboard.

kishor010 commented 7 years ago

@kitasuke I saw example project only. But it's not connected via storyboard. Thanks

kitasuke commented 7 years ago

It is. https://github.com/kitasuke/PagingMenuController/blob/master/Example/PagingMenuControllerDemo/UsersViewController.swift#L14:L16

kitasuke commented 7 years ago

If you have further questions, please ask them on stackoverflow since your question is not related to PagingMenuController itself. It's better place for you.

yakupad commented 7 years ago

Thanks 👍 💯 🥇