Henny Lee Henny Lee - 1 year ago 144
Objective-C Question

setBounds in Swift

I'm trying to convert a Objective-C app to Swift but I'm stuck with

. The original code looks like this:

- (void)setBounds:(CGRect)bounds {
[super setBounds:bounds];

// code

What is the equivalent in Swift? I've tried looking in the documents and google but can't seem to figure it out.

Answer Source

You need to override bounds:

override var bounds: CGRect{
          //your code here  
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download