This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
extension UICollectionViewCell { | |
static var reuseID: String { String(describing: self) } | |
} | |
final class ExpandableCell: UICollectionViewCell { | |
static let height = 50 | |
static let collapsedSize = CGSize(width: 50, height: height) | |
static let expandedSize = CGSize(width: 200, height: height) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct CPUUsageInfo { | |
func getCPUUsage() -> Double { | |
var kr: kern_return_t | |
var task_info_count: mach_msg_type_number_t | |
task_info_count = mach_msg_type_number_t(TASK_INFO_MAX) | |
var tinfo = [integer_t](repeating: 0, count: Int(task_info_count)) | |
kr = task_info(mach_task_self_, task_flavor_t(TASK_BASIC_INFO), &tinfo, &task_info_count) | |
if kr != KERN_SUCCESS { |