aman
aman

Reputation: 539

Xcode storyboard class has no module

I have a project with two targets A and B.

When I open my storyboard and select one scene in particular and navigate to 'identity inspector' > 'custom class' > 'Module',

there is a single blank entry in the drop down (the drop down does not display A or B). When I select the blank entry the drop down shows "None". This is a problem because it causes my program to crash when attempting to use the scene.

If I select 'Inherit module from target', the correct target displays under 'identity inspector' > 'custom class' > 'Module', however my program will still crash when attempting to use the scene.

The class itself is found in the type-ahead of the 'identity inspector' > 'custom class' > 'Class' textbox.

The name of the class is SWRevealController.m (which is an obj-c file) whereas most of my project is in swift.

A and B appear as selectable in every other scene under 'identity inspector' > 'custom class' > Module. I can also select 'inherit module from target' for those scenes and the program does not crash.

Other things I have tried: *manually deleting and re-adding the SWRevealController.m under 'Build Phases' > 'Compiled sources' *making a new storyboard and putting view controllers in from scratch.

The main.storyboard itself is part of both targets.

Upvotes: 0

Views: 1590

Answers (2)

aman
aman

Reputation: 539

OK, what I did that worked for me (which I should not have had to do but it works) was 4 things.

  1. Go into the SWRevealViewController.m and add
    @class SWRevealViewControllerSegueSetController;

To make the seguesetcontroller available for step #2.

  1. Make a swift file that inherits from the objective-C classes (and do nothing else)
    import Foundation
    
    final class MyRevealViewController : SWRevealViewController
    {
      
    }
    
    final class MyRevealViewControllerSegueSetController : SWRevealViewControllerSegueSetController
    {
      
    }
  1. Go into my storyboard and change the class from SWRevealViewController to MyRevealViewControllerSegueSetController. At this point, the different targets A and B appear in the drop down under 'identity inspector' > 'custom class' > 'Module'.

  2. I needed to change the Segue classes used in my storyboards from SWRevealViewControllerSegueSetController to MyRevealViewControllerSegueSetController

Upvotes: 2

Saqib R.
Saqib R.

Reputation: 3069

Odd enough, I selected one of the presented options from class dropdown and it enabled itself.

enter image description here

Upvotes: 0

Related Questions