ykyouhei / KYDrawerController

Side Drawer Navigation Controller similar to Android
MIT License
622 stars 159 forks source link

'KYEmbedMainControllerSegue' is not a member type of 'KYDrawerController' #95

Open amarcadet opened 7 years ago

amarcadet commented 7 years ago

I'm using R.swift and I have an issue with KYDrawerController module naming.

R.swift generate the following code:

import Foundation
import KYDrawerController
import Rswift
import UIKit

/// This `R` struct is generated and contains references to static resources.
struct R: Rswift.Validatable {

  /// This `R.segue` struct is generated, and contains static references to 2 view controllers.
  struct segue {
    /// This struct is generated for `MainViewController`, and contains static references to 2 segues.
    struct mainViewController {
      /// Segue identifier `home`.
      static let home: Rswift.StoryboardSegueIdentifier<KYDrawerController.KYEmbedMainControllerSegue, MainViewController, UIKit.UINavigationController> = Rswift.StoryboardSegueIdentifier(identifier: "home")
      /// Segue identifier `menu`.
      static let menu: Rswift.StoryboardSegueIdentifier<KYDrawerController.KYEmbedDrawerControllerSegue, MainViewController, MenuViewController> = Rswift.StoryboardSegueIdentifier(identifier: "menu")

      // ...

The thing is KYDrawerController is both the module name and the controller class name. At compile time Xcode throw the following error:

/[redacted]/R.swift/R.generated.swift:57:76: 'KYEmbedDrawerControllerSegue' is not a member type of 'KYDrawerController'

Looks like R.swift use the module name defined in IB and prepend it to the segue class. The only workaround I can think of is subclassing KYEmbedMainControllerSegue into a class the belongs to my app module so there should be no module name issue. Unfortunately, these classes are not open so I can't subclass them.

Do you have a workaround to address this issue?

Thanks for your help!

letsspeak commented 6 years ago

I forked and fix this issue by renaming classes. You can use my repo and branch. https://github.com/letsspeak/KYDrawerController/tree/swift4-rswift

pod 'KYDrawerController', :git => 'https://github.com/letsspeak/KYDrawerController', :branch => 'swift4-rswift' # Swift4/Xcode9 comfortable
timusus commented 6 years ago

I'm not sure if this is an issue with KyDrawerController, or R.swift..

In any case, fixing this would likely require a major version increment, as it would be an API breaking change.

@letsspeak is this something you think the library should address, or can this issue be closed?