If I create an object in paint code I, am then either given a style sheet or code from the tab section.
Stylesheet:
import Cocoa
public class StyleKitName : NSObject {
//// Drawing Methods
public class func drawMain() {
//// Color Declarations
let color = NSColor(calibratedRed: 1, green: 0, blue: 0, alpha: 1)
//// Rectangle Drawing
let rectanglePath = NSBezierPath(rect: NSMakeRect(29, 30, 198, 166))
color.setFill()
rectanglePath.fill()
}
}
Code from tab:
//// Color Declarations
let color = NSColor(calibratedRed: 1, green: 0, blue: 0, alpha: 1)
//// Rectangle Drawing
let rectanglePath = NSBezierPath(rect: NSMakeRect(29, 30, 198, 166))
color.setFill()
rectanglePath.fill()
How do I then go about importing this into my swift project. I have tried putting the style sheet in a separate .swift
file then calling the function from my viewDidLoad
function in the NSViewController
by doing: var rectangle = StyleKitName.drawMain()
but nothing appeared on the NSView. I also tried pasting the code from the tab directly into the view controller's view did load but nothing appeared on the view controller.
Does anybody know what I'm doing wrong?