Home>
An error occurred in the following code, but the cause is unknown.
import Foundation
import UIKit
class ChangeColor {
func changeColor (topR: CGfloat, topG: CGfloat, topB: CGfloat, topAlpha: CGfloat,
bottomR: CGfloat, bottomG: CGfloat, bottomB: CGfloat, bottomAlpha: CGfloat)->CAGradientLayer {
// Gradient start color
let topColor = UIColor (red: topR, green: topG, blue: topB, alpha: topAlpha)
let bottomColor = UIColor (red: bottomR, green: bottomG, blue: bottomB, alpha: bottomAlpha)
// Manage gradient colors in an array
let gradientColor = [topColor.cgColor, bottomColor.cgColor]
let gradientLayer = CAGradientLayer ()
gradientLayer.colors = gradientColor
return gradientLayer
}
}
The contents of the error are "Use of undeclared type 'CGfloat'" in the place of the functionchangeColor
, and "Expected initial value after '='" in the part where the gradation color of the comment is written for some reason. I got out.
I looked at it from the error content and it seemed that there were no elements that could cause the error.
I don't know why this error has occurred, so I would appreciate your advice.
Addition
When I built it again, the second "Expected initial value after '='" error was gone.
-
Answer # 1
-
Answer # 2
CGfloat
Uppercase letters up to F.
-
Answer # 3
Not
CGfloat
, it will beCGFloat
.
Use the Xcode completion feature.
Related articles
- ios - about management and profitability of apps developed by receiving orders
- python - about the error cannot reshape array of size
- ios - about tap judgment of reality kit
- ios - no numbers are displayed and an error occurs
- about the error when converting a floating point number in c language to an integer
- javascript - about the error "cannot read property'indexof' of null"
- ios - i get an error when trying to add ads using google admob in unity
- javascript - about roulette creation error
- ruby - about error of update action when nesting
- jquery - i get an error about $() animate is not a function
- ios - about processing when data could not be obtained by api
- ruby on rails 5 - about lint/syntax error of rubocop
- ruby - about the error content displayed in "rails" rspec
- about unpickling error in python socket communication
- vba - about index error
- python - about openpyxl error avoidance
- parameters - about error when calculating python sarimx parameter optimization
- about symbolicate (restore) of crash log due to rejection when applying for swift iosapp
- python - about error no such file or directory on google colab
- about management screen error in wordpress version 55
Related questions
- swift : I want to upload /download photos taken with an app to iCloud
- ios - [swift] i want to register user name at the same time as signing up with firebaseauth
- ios - about the mechanism that can pass by value at the time of screen transition in segue
- ios - it is about line breaks when using uitextview wrapped in swift ui
- ios - i want to get only 0 from the array of 0s and 1s
- ios - [xcode] regarding the screen transition, it became a strange screen display
- ios - thread 1: exception: error is displayed!
- ios - [swift] about the header of tableview i want to prevent the header from following even if it scrolls ]
- ios - [in app store connect] i want to submit the app to the app store for review, but an error occurs
- ios - i can't see the keyboard in the xcode simulator
CGFloat
wasCGfloat
.After fixing this, the build passed.