carlca
(Carl Caulkett)
1
My project is going well, but I am now looking to construct a Library of my own with useful functions. I've created a Framework called SwiftLib (I'll come up with a better name soon!) and built it. I located the SwiftLib.framework folder and added the path to the Frameworks, Libraries and Embedded Content section of my Plugin Manager project, as shown...
There is just one public class in there...
import Foundation
import SwiftUI
public class TextUtils {
func textSize(text: String, fontName: String, size: CGFloat) -> CGSize{
let font = NSFont(name: fontName, size: size)
let size: CGSize = text.size(withAttributes: [.font: font ?? NSFont.systemFont(ofSize: 14)])
return size
}
}
The problem comes when I try to access the framework from code. If I try import SwiftLib, Xcode just complains that there is No such module. What am I doing wrong?
Hello Carl,
Have you updated the Frameworks Search Paths in the Build Settings with the path to your framework?
carlca
(Carl Caulkett)
3
Thanks for the reply, Caio! I've got this. It wasn't labelled Frameworks Search Path but it is where my Framework got build to...
1 Like