As you guys know that in property:
Here this code represents a class corresponding to an entity named as "TracksAndTracksCounters" && this class uses Objective C runtime also is a Non UI class.
*******Why USE "weak" in @IBOutlet attribute ???
"@IBAction func <function_name>(sender: AnyObject) {}" or
"@IBOutlet weak var <property_name> : <type_name>"
The above 1st declared line is the property by using it we can reference to any UI component present in the interface builder && can perform any task accordingly because it is just like a function, in fact, it is a function that perform any specified task as an action according to the tap done on any component on the storyboard. And 2nd declared property is any outlet property by which again we can refer to any UI component present on the storyboard but can't perform any action accordingly like IBAction property.
Here @IBAction or @IBOutlet are two attributes defined in UIKit && these attributes allows interface builder to bind to properties. And you should know that when defining your class with these two properties (@IBOutlet && @IBAction) one most important thing to note is that "@objc" attribute is also added && it will force the, Swift classes in which you defined this property to use "Objective C" runtime.Do you know why this happens, as I described that both @IBAction && @IBOutlet attributes are defined in UIKit && All UIKit classes are of Objective C classes, thats why. Again the next important point to note is that defining some properties with these attributes associated with, is not cause any trouble where Objective C runtime is used && necessary but care should be taken where Objective C runtime should not be used. Also "@objc" object can be used with Non UI classes that uses Objective C runtime like when you create a NSObject class corresponding to an entity in Core Data like as shown in below written code:
import Foundation
import CoreData
@objc(TracksAndTracksCounters)
class TracksAndTracksCounters: NSManagedObject {
@NSManaged var urlOfSong: AnyObject
}
*******Why USE "weak" in @IBOutlet attribute ???
Usually, all the connections of type @IBOutlet should be of marked with "weak" keyword because you know that storyboard or xib file is the owner of the object marked with this attribute not the controller (your class file) in which you are defining it && ownership will not pass automatically when assigning properties from Interface builder to the controller.So changing the keyword other than weak may cause you app trouble like circular references. If you use strong instead of weak it may cause memory leakage of your app.