Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumSwiftgenerics and constraintsSingle-choice MCQ

What is the output of this code involving a generic type with a static stored property?

struct Counter<T> { static var count: Int { _count } static var _count: Int = 0 static func bump() { _count += 1 } } Counter<Int>.bump() Counter<Int>.bump() Counter<String>.bump() print(Counter<Int>.count, Counter<String>.count)