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?