How do you find how much disk space is left in Coc

2020-02-24 04:43发布

I suppose I'd like to be able to find out for any storage, not just the system disk, but that's most important.

7条回答
祖国的老花朵
2楼-- · 2020-02-24 04:58

Through swift you can get free space by using this function

func getFreeSpace() -> CGFloat {
      do {
         let fileAttributes = try NSFileManager.defaultManager().attributesOfFileSystemForPath("/")
         if let size = fileAttributes[NSFileSystemFreeSize] as? CGFloat {
            return size
         }
      } catch { }
      return 0
   }
查看更多
登录 后发表回答