Lawrence Gimenez

What's your signature code?

What’s your signature code? Mine is initViews(), short for “initialize views”. Since the start of my development career, this is the first function that I will always write. In Java, the difference is just the semi-colon: initViews();.

Looking at my old Android Java codes, it is somewhat amazing (for me) that I have continued this tradition still. This function is called inside viewDidLoad() for iOS or onCreate(Bundle savedInstanceState) for Android. Its purpose is to initialize all views and their properties during the launch of either AppCompatActivity or UIViewController.

For example:

 override fun onCreate(savedInstanceState: Bundle?) {
        binding = ActivityMessageRoomBinding.inflate(layoutInflater)
        val view = binding.root

or in iOS

override func viewDidLoad() {

Source codes will always evolve, I have contributed to over 40 (or more not sure) mobile app projects and it would be an honor if my initViews() stayed and were not refactored out. If you see this function call, there’s a huge possibility it was written by me. Thanks!