Hmmm, this is working for me. Here’s what I did:
I ran Xcode 11.1 (on 10.14.6, but I don’t think that’s relevant) and created a new framework from the macOS > Framework template.
I added a new
TFHello.swift
file with the contents:
import Foundation
public enum TFHello {
public static func sayHello() {
NSLog("Hello Cruel World!")
}
}
.
I set Build Libraries for Distribution (
BUILD_LIBRARY_FOR_DISTRIBUTION
) build setting.I built the framework.
I control-clicked on the framework in the Project navigator and choose Show in Finder.
Using the Finder, I copied that framework to my desktop.
Back in Xcode 11.1, I closed the project and quit Xcode itself.
I opened Xcode 11.2b2 and created a new app from the macOS > App target.
I moved the framework from step 6 into that directory.
I added that framework to the target.
I changed the
ViewController.viewDidLoad
method to call it:
override func viewDidLoad() {
super.viewDidLoad()
TFHello.sayHello()
}
.
I added a Copy Files build phase to copy it into the app’s Frameworks directory.
I did a build and run. The app built and, on launch, it logged:
2019-10-21 09:44:50.671009+0100 TestClient[42046:7455817] Hello Cruel World!
.
I’m not sure why this isn’t working for you. My advice is that you try to replicate my steps to check that things are working in general. Then you can compare my process to the process you used in your real project to see what’s different.
Share and Enjoy
—
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"