Swift💯 1liner+Swift6+Longhand
One-Liner, terse (accepted answer)One-Liner, Swift 6 (accepted answer)Good Interview Answers (accepted answers)
**One-Liner, terse (accepted answer)**
```
class Solution {
    func prefixCount(_ w: [String], _ p: String) -> Int {
        w.filter{$0.hasPrefix(p)}.count
    }
}
```

**One-Liner, Swift 6 (accepted answer)**
```
class Solution { // Swift 6 required (leetcode still 5.x)
    func prefixCount(_ w: [String], _ p: String) -> Int {
        w.count{$0.hasPrefix(p)}
    }
}
```

**Good Interview Answers (accepted answers)**
```
class Solution {
    func prefixCount(_ words: [String], _ pref: String) -> Int {
        var count = 0
        for word in words {
            guard 
                word.count >= pref.count,
                zip(word, pref).allSatisfy(==)
            else { continue }
            count += 1
        }
        return count
    }
}
```
```
class Solution {
    func prefixCount(_ words: [String], _ pref: String) -> Int {
        var count = 0
        for word in words where word.prefix(pref.count) == pref {
            count += 1
        }
        return count
    }
}
```
['Swift']