Unable to get CGRect.null and CGPoint in Package after upgrading to Xcode 14.1

I have a MacOS package dependency which defines some class: FontPens

  import Foundation
  ...
  public class BoundsPen: Pen {

        var bounds = CGRect.null
        private var currentPoint = CGPoint.zero
        ....

After upgrading Xcode to 14.1 both lines throws errors Type 'CGRect' has no member 'null' and Type 'CGPoint' has no member 'zero'.

Calling CGPoint.zero and CGRect.null from an app is OK if Foundation is imported.

Is it a way to solve this problem without changing package source?

Answered by DTS Engineer in 735069022

The story of CFRect and friends is a long and complex one. You should feel free to file a bug about this source incompatibility. Please post your bug number, just for the record.

However, the correct fix here is to import CoreGraphics in that package. That’s the ultimate source of these types.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Accepted Answer

The story of CFRect and friends is a long and complex one. You should feel free to file a bug about this source incompatibility. Please post your bug number, just for the record.

However, the correct fix here is to import CoreGraphics in that package. That’s the ultimate source of these types.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Unable to get CGRect.null and CGPoint in Package after upgrading to Xcode 14.1
 
 
Q