Skip to content

Instantly share code, notes, and snippets.

@ishabazz
Last active July 2, 2021 16:09
Show Gist options
  • Save ishabazz/3869abc1ddd43c2972cdf0eae08853ac to your computer and use it in GitHub Desktop.
Save ishabazz/3869abc1ddd43c2972cdf0eae08853ac to your computer and use it in GitHub Desktop.
import SwiftUI
extension ContentSizeCategory: Identifiable {
var id: Int { hashValue }
}
//Example
struct HelloWorld_Previews: PreviewProvider {
static var previews: some View {
Group {
ForEach(ContentSizeCategory.allCases){ size in
Text("Hello, World!")
.environment(\.sizeCategory, size)
}
}
.previewLayout(PreviewLayout.sizeThatFits)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment