Import failure of CGFloat in LineManager class
irangareddy opened this issue · comments
Summary:
Import failure of CGFloat in LineManager class, causing fastlane build error while compiling WrappingHStack.swift
Steps to reproduce:
Create a new Xcode project.
Add the following code to a file in the project:
import Foundation
enum Stage {
case child
case boyhood
case adult
case old
var ageBar: CGFloat {
switch self {
case .child:
return 0.2
case .boyhood:
return 0.4
case .adult:
return 0.8
case .old:
return 1.0
}
}
}
Build and run the project.
Expected result:
The project builds and runs without any errors.
Actual result:
The project fails to build with the following error:
Cannot find type 'CGFloat' in scope
Code that causing an issue with respect to WrappingHStack. reference
import Foundation
/// This class is in charge of calculating which items fit on which lines.
/// It should be reused whenever possible.
class LineManager {
private var contentManager: ContentManager!
private var spacing: WrappingHStack.Spacing!
private var width: CGFloat!
}
Version Details
{
"package": "WrappingHStack",
"repositoryURL": "https://github.com/dkk/WrappingHStack.git",
"state": {
"branch": null,
"revision": "3cc84e786aa996da32f476d89dab4e02d30ce691",
"version": "2.1.3"
}
}
Notes:
It seems that the import of the Foundation module is not sufficient to use the CGFloat type.
To fix this issue, you can import the CoreGraphics module, which defines the CGFloat type, by adding the following line to the top of the file:
import CoreGraphics
After importing the CoreGraphics module, the CGFloat type should be available and the project should build and run without any errors.
Thank you @dkk