Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func camelFirst() -> String? {
- let item = self.matchingStrings(regex: "[^A-Z]+")
- if item.count > 0 {
- if item[0].count > 0 {
- return item[0][0]
- }
- else { return nil }
- }
- else {
- return nil
- }
- }
- class func openStoryboardId(_ caller: UIViewController, id: String) -> UIViewController? {
- if let name = id.camelFirst() {
- if let currentID = caller.restorationIdentifier {
- if let current = currentID.camelFirst() {
- if current == name {
- return caller.storyboard?.instantiateViewController(withIdentifier: id)
- }
- else {
- let storyboard = UIStoryboard(name: name.capitalized, bundle: nil)
- return storyboard.instantiateViewController(withIdentifier: id)
- }
- }
- else {
- let storyboard = UIStoryboard(name: name.capitalized, bundle: nil)
- return storyboard.instantiateViewController(withIdentifier: id)
- }
- }
- else {
- let storyboard = UIStoryboard(name: name.capitalized, bundle: nil)
- return storyboard.instantiateViewController(withIdentifier: id)
- }
- }
- else {
- return nil
- }
- }
- func openOtherView() {
- if let viewController = DTUI.openStoryboardId(self, id: "settingSettings") {
- self.navigationController?.pushViewController(viewController, animated: true)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement