0

I want to import a file/class I created in the main project inside an Application Extension. How can I achieve that?

File inside my main project:

struct MyConstants {
    static let = MaxChars = 100
}

In Share Extension:

import UIKit
import Social

class ShareViewController: SLComposeServiceViewController {
    let maxCharactersAllowed = MyConstants.MaxChars // Basically what I want to do
}
Esqarrouth
  • 38,543
  • 21
  • 161
  • 168

1 Answers1

1

It should be as easy as adding the file to your extension target/project so that both are part of the same module. Same module means internal scope and the constant should be accessible from the other file automatically.

https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/AccessControl.html

iOSX
  • 1,270
  • 13
  • 18