Question: I'm trying to import some pointcloud coordinates into python, the values are in a text file in this format 

```
0.0054216 0.11349 0.040749   
-0.0017447 0.11425 0.041273  
-0.010661 0.11338 0.040916  
0.026422 0.11499 0.032623

```

and so on.  

Ive tried doing it by 2 methods

```
def getValue(filename):       
    try:                                                                            
        file = open(filename,'r')  
    except: IOError:  
       print ('problem with file'), filename       
    value = []  
    for line in file:  
        value.append(float(line))  
    return value  

```

I called the above code in idle but there is an error that says the string cannot be converted to float.

```
import numpy as np  
import matplotlib.pyplot as plt

data = np.genformtxt('co.txt', delimiter=',')

```

In this method when I call for data in idle it says data is not defined.

Below is the error message

```
>>> data[0:4]
Traceback (most recent call last):
File "<pyshell#14>", line 1, in <module>
data[0:4]
NameError: name 'data' is not defined

```

Answer: 
The view shouldn't be responsible for any transformation and manipulation of data.
There are two possible way to overcome this problem:

1. Create computed properties or methods in the model and use them in the view. I prefer computed properties because the code is more clean and understandable.
2. Manage all the transformation and manipulation in the Presenter class. The aim of this class in the MVP Pattern is to take the model, do some stuff, and pass the final data to be presented at the view.

Both ways are correct, it depends on the context. Maybe the second way is more close to the pattern but it depends.

For some documentation about computed properties: 
<https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/Properties.html#//apple_ref/doc/uid/TP40014097-CH14-ID259>
With MVP you want your Presenter layer doing all the custom display logic for the View layer and you don't want to do anything to your Model layer, it should just be a plain representation of how object is defined in the database). 

Firstly I would create a custom init in a string extension file e.g.

```
extension String {

   init(from date: Date) {
       // custom logic goes here
   }
}

```

Then in your relevant Presenter just have a have a property that calls this extension class to do the data manipulation, this way other presenters can also use this logic e.g.

```
public class Presenter {

    public var customProperty: String {

       return String.init(from: model.date)        
    }
}

```