Reputation: 424
I am brand new to Xcode. Thank you for reading this.
I'm simply attempting to get used to the language, so I'm simply messing with code by importing Foundation and creating a simple NSRect. However, I'm getting an error when I try to create NSRect.
Here's the code:
import Foundation
import UIKit
let rect = NSRect(x: 50, y: 50, width: 100, height: 100)
And then I receive an error saying "Use of unresolved identifier 'NSRect"." What am I doing incorrectly?
Thank you for your help!
Upvotes: 1
Views: 2329
Reputation: 10432
Use CGRect instead of NSRect . NSRect is for Cocoa, if project is for mac app use import Cocoa
.
import Foundation
import UIKit
let rect = CGRect(x: 50, y: 50, width: 100, height: 100)
Upvotes: 3