Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swift: Importing Custom Framework - Use of Unresolved Identifier

Tags:

ios

swift

xcode6

After moving some code into an external framework I've been trying to import and use the framework in my app. I've added the framework as a dependency in my app.

My framework is called DiceKit. In one of the classes, just to test things out, I've added import DiceKit to the top of my file. This is not throwing any errors.

When I try to access the classes that should be in the framework, I get a Use of Unresolved Identifier error.

import UIKit
import DiceKit

class FirstViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        println (Die(12).roll())   // `Die` doesn't exist at compile time
    }
}

What could be causing the classes in the framework to not be compiled? I have made sure that all the classes and methods are marked with public and I haven't changed any build settings from the default in my framework.

I'm using XCode 6.3 Beta

Thanks for your help!

like image 397
Mims H. Wright Avatar asked May 17 '15 08:05

Mims H. Wright


1 Answers

In your DiceKit custom framework

You should declare your Die class as public.

public public public all the things! Or at least, the things that others need to use from the framework. 

like image 74
IKKA Avatar answered Oct 21 '22 08:10

IKKA