02-ContentView-9.swift 501 B

12345678910111213141516171819
  1. @State var showAlert = false
  2. @State var cacheSizeResult: Result<UInt, KingfisherError>? = nil
  3. var body: some View {
  4. List {
  5. Button("Check Cache") {
  6. KingfisherManager.shared.cache.calculateDiskStorageSize { result in
  7. cacheSizeResult = result
  8. showAlert = true
  9. }
  10. }
  11. ForEach(0 ..< 10) { i in
  12. HStack {
  13. KFImage(url(at: i))
  14. // ...
  15. }
  16. }
  17. }.listStyle(.plain)
  18. }