strings – Is there a shorter/better way to do this simple problem in Swift?

I am learning swift and then I came across this problem.
Converting each start letter to capitalized form if its lowercased.

func upperCaseFirstCharacter(str:String){
    let myArr = str.components(separatedBy: " ")
    var finalStr :String=""
    for word in myArr {
        let myStr = word.replacingCharacters(in: ...str.startIndex, with: word.first?.uppercased() ?? "")
        finalStr.append(myStr)
        if myArr.last != word{
            finalStr.append(" ")
        }
    }
    print(finalStr)
}