Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swift 2 :IBOutlet Collection [UIButton]! leaks memory

Recently in my app I have found out that my UIButton outlet collection is leaking memory.

All I have is

    @IBOutlet var TabBarButtons: [UIButton]!

And from Instrument enter image description here

Can anyone tell me what's gone wrong? As time goes on, the amount of variables in the NSArray keeps growing and all I have is an array with 4 UIButtons from IB.

like image 730
GalaxyVintage Avatar asked Dec 03 '15 20:12

GalaxyVintage


1 Answers

This is a bug. Reference rdar://24272775

Workaround for now is to replace [UIButton]! with NSArray! and cast its contents to UIButton later when used.

like image 84
Joe Collins Avatar answered Oct 06 '22 23:10

Joe Collins