Skip to main content

Posts

Showing posts from November, 2018

User defined settings iOS

With User defined settings  we can set values specific to build configuration. Creating User Defined Settings Select Target > Build Settings Click Plus icon, present beside the search bar Using User Defined Settings when we need to access the values set in User defined build settings we can do it in two ways  From info.plist $(NEW_SETTING) From Code let value = Bundle.main.infoDictionary?["NEW_SETTING"] as! String

Memory Management in iOS

The two basic rules of Memory Management are Objects obtained with  -alloc ,  -new ,  -copy , or  -mutableCopy  have a retain count of one. For objects created with any other method, assume they have a retain count of one but will be autoreleased . If you need to keep them in memory, you need to explicitly retain them. Lets see in detail how the memory management works, Memory management concepts are of critical importance and every Cocoa programmer should take the time to master them. Memory management in Cocoa comes in two flavors:  classic retain counts  and  garbage-collected . The question deals with the retain count flavor, so I will focus on that one. The retain count memory management scheme in Cocoa works on the basis that an object will remain in memory as long as other objects claim to be "interested in it." The Objective-C runtime keeps track of this "interested in" relationship with a simple number: the  retain c...