Question: I am trying to parse/organize a list of strings line by line from a text file into an array that is in Ruby. I hope I explained that right.

example.txt

```
exampleuser:examplepassword
myusername:mypassword
askfjwaeir:dcqw38974q238ifj

```

How I want to store example.txt in Ruby - 

```
$username = [ "exampleuser",
      "myusername",
      "askfjwaeir"
]

$password = [ "examplepassword",
      "mypassword",
      "dcqw38974q238ifj"

```

I've been searching for a couple hours but can't seem to find anything to what I'm looking for. I know about .strip, .split, cutting off from the semicolon, but I cannot seem to do what I described here.

Answer: 
You can use extension of `UIViewController` 

```
extension UIViewController
{
   // write code that has to be used in all view controllers
   func applyTheRequiredPropertiesToGestureRecognizer(gr:UIGestureRecognizer)
   {
      // do whatever you want to do
   }
}

```

Later while using

```
class SomeViewController:UIViewController{

   let gestureRecog = UIGestureRecognizer()

   //call the method 
   func someMethod()
   {
     self.applyTheRequiredPropertiesToGestureRecognizer(gestureRecog)
   }
}

```
Using base controller is certainly a common approach.

A common base controller often becomes a dumping ground for functionality that is used in multiple-but-not-all controllers, so it become overkill.

I also followed this pattern in my project but later it becomes complicated for me when i start using other controllers like `UITableViewController, UICollectionViewController` etc.

Agreed with [Sulthan's comment](https://stackoverflow.com/questions/44254972/uiviewcontroller-base-class-is-it-good-or-not#comment75518820_44254972): **using a category and turn it on explicitly on every controller** would definitely be a better option.