Deepa Pai your a genius.
Post
Replies
Boosts
Views
Activity
Hello,
Thanks for your response.
Im using SwiftUI and I have called that function with the below line of code.
view.setNeedsDisplay(viewSize)
where viewSize is a NSRect.
I think maybe it has something to do with the text colour as I am using a 'patterImage'. Maybe it's possible that the old patternImage is remaining in memory in some instances however im not sure how I can isolate that. It happens maybe one in 50 times the text is changed.
let gradientNumber = Int.random(in: 0..gradients.count)
let selectedGradient = gradients[gradientNumber]
selectedGradient?.size = .init(width: screenWidth, height: screenHeight)
label.textColor = NSColor (patternImage: selectedGradient!)
view.setNeedsDisplay(viewSize)
This is the code that applies the text colour, .tile wouldn't work properly because it's a gradient not a flat colour.
cheers.