I want to create a gradient layer and insert it in a view but the view is not fully filled...
My actual code is :
gradientLayer.frame = topView.bounds
gradientLayer.colors = [UIColor.white.cgColor, UIColor.black.cgColor]
topView.layer.insertSublayer(gradientLayer, at: 0)
This is my code and storyboard (In red is the part I want to fill)
I don't have clue on it.. It works on fullscreen view but not in more little view..
The top view is imported from the storyboard of course. Maybe I did a mistake with view.bound I don't know. I'm a beginner in swift and iOS so everything is possible !
EDIT : The problem is not the size of the view but the size of the layer which is too small because the background color of the view fill all the space but not the layer