'How to create an array with Character in count String in Swift 5.5 [closed]

var myStr = "Swift"

let myCh: Character = "S"

var myArr = Array(repeating: String(myCh), count: myStr.count)
myArr        //   ["S", "S", "S", "S", "S"]

This code doesn't work in swift 5.5, how can i repeat it in other way?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source