https://www.netguru.com/blog/on-device-training-with-core-ml-make-your-pancakes-healthy-again
[Apple docs]Personalizing a Model with On-Device Updates
On-device training with Core ML by Matthijs Hollemans:
https://www.netguru.com/blog/on-device-training-with-core-ml-make-your-pancakes-healthy-again
[Apple docs]Personalizing a Model with On-Device Updates
On-device training with Core ML by Matthijs Hollemans:
| /// header | |
| id CGSCopyManagedDisplaySpaces(int conn); | |
| int _CGSDefaultConnection(); | |
| id CGSCopyWindowsWithOptionsAndTags(int conn, unsigned owner, NSArray *spids, unsigned options, unsigned long long *setTags, unsigned long long *clearTags); | |
| // code | |
| int spaceNumber = 0; // the space you want to get the windows for. numbering starts at 0. |
| extension NSFont { | |
| class func roundedFont(ofSize size: CGFloat, weight: NSFont.Weight) -> NSFont { | |
| let systemFont = NSFont.systemFont(ofSize: size, weight: weight) | |
| guard let descriptor = systemFont.fontDescriptor.withDesign(.rounded), | |
| let roundedFont = NSFont(descriptor: descriptor, size: size) else { | |
| return systemFont | |
| } | |
| return roundedFont | |
| } |
| func test(with identifier: String = #function, body: (XCTestExpectation) -> Void) { | |
| let expectation = expectation(description: identifier) | |
| body(expectation) | |
| waitForExpectations(timeout: 0.5) | |
| } | |
| func testAscending() { | |
| let a = [1] | |
| test { expectation in |
| extension UIStackView { | |
| func setSpacing(_ spacing: CGFloat, after arrangedSubview: UIView) { | |
| guard let index = arrangedSubviews.firstIndex(of: arrangedSubview) else { return } | |
| let spaceView = UIView() | |
| spaceView.translatesAutoresizingMaskIntoConstraints = false | |
| switch axis { | |
| case .horizontal: | |
| spaceView.widthAnchor.constraint(equalToConstant: spacing).isActive = true |
| // For views that can be loaded from nib file | |
| protocol NibLoadable { | |
| // Name of the nib file | |
| static var nibName: String { get } | |
| static func createFromNib(in bundle: Bundle) -> Self | |
| } | |
| extension NibLoadable where Self: NSView { | |
| // Default nib name must be same as class name |
| extension NSImage { | |
| func appIcon(h:CGFloat = 35) -> NSImage { | |
| let size = NSSize(width: h, height: h) | |
| let cornerRadius: CGFloat = h/5 | |
| guard self.isValid else { | |
| return self | |
| } | |
| let newImage = NSImage(size: size) |
| extension NSBezierPath { | |
| var cgPath: CGPath { | |
| let path = CGMutablePath() | |
| var points = [CGPoint](repeating: .zero, count: 3) | |
| for i in 0 ..< self.elementCount { | |
| let type = self.element(at: i, associatedPoints: &points) | |
| switch type { | |
| case .moveTo: | |
| path.move(to: points[0]) |
| class GradientView: UIView { | |
| var gradientLayer: CAGradientLayer! | |
| override init(frame: CGRect) { | |
| super.init(frame: frame) | |
| commonInit() | |
| } | |
| required init?(coder: NSCoder) { | |
| super.init(coder: coder) |