Q:

How to add two times? 

I know it is a really basic question, I am working on a activity app in which I get a string array of time as [00.30.00,00.30.00,00.30.00] from webservice in format (HH.MM.SS), My task is to add the time and display as 01.30.00.  Can anyone guide me?  Thanks. 
import UIKit

class ViewController: UIViewController {

var timeArray = ["00.30.00","00.30.00","00.30.00"]
var sepratedArray:[Time] = []

override func viewDidLoad() {
    super.viewDidLoad()

    for items in timeArray {
        let tempArray = items.components(separatedBy: ".") 
        sepratedArray.append(Time(hours: Double(tempArray[0])!,  minutes: Double(tempArray[1])!,  Seconds: Double(tempArray[2])!)) 
    }
    print(sepratedArray)

   for item in 0...sepratedArray.count-1 {
        _ = Int(sepratedArray[item].Seconds)
        _ = Int(sepratedArray[item].minutes)
        _ = Int(sepratedArray[item].hours)+1
    }
    print("count ary is: \(sepratedArray)")
    // Do any additional setup after loading the view, typically from a nib. 
}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated. 
}
}
struct Time
{
var hours: Double
var minutes: Double
var Seconds: Double
}

A:

You can use this function which calculates the sum, taking into account that seconds and minutes should not have higher values than 59 (note that this function does not handle wrong formats):
func sum(_ timeArray: [String]) -> String {
    var sum = [0, 0, 0]
    for time in timeArray {
        let components = time.split(separator: ".") 
        sum[0] += Int(components[0])! 
        sum[1] += Int(components[1])! 
        sum[2] += Int(components[2])! 
    }

    for componentIndex in [2, 1] {
        while sum[componentIndex] > 59 {
            sum[componentIndex] -= 60
            sum[componentIndex - 1] += 1
        }
    }

    return String(format: "%02d.%02d.%02d", sum[0], sum[1], sum[2])
}

like this:
let time = ["00.30.00", "00.30.00", "00.30.00"]
print(sum(time)) // prints 01.30.00

