Mims H. Wright
Mims H. Wright

Reputation: 3037

Swift: Importing Custom Framework - Use of Unresolved Identifier

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!

Upvotes: 9

Views: 2886

Answers (1)

JAK
JAK

Reputation: 6471

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. 

Upvotes: 6

Related Questions