Skip to content

Instantly share code, notes, and snippets.

View scchn's full-sized avatar
🐈‍⬛

scchn

🐈‍⬛
  • Taiwan
  • 07:42 (UTC +08:00)
View GitHub Profile
@scchn
scchn / NSBezierPath+cgPath.swift
Created January 6, 2023 17:42 — forked from juliensagot/NSBezierPath+cgPath.swift
Convert NSBezierPath to CGPath (Swift 5.1, Xcode 11.3 (11C29))
extension NSBezierPath {
/// A `CGPath` object representing the current `NSBezierPath`.
var cgPath: CGPath {
let path = CGMutablePath()
let points = UnsafeMutablePointer<NSPoint>.allocate(capacity: 3)
if elementCount > 0 {
var didClosePath = true

@State

儲存 struct,通常為 View 的私有成員變數。

@State private var count = 0

@Binding

//
// Bookmark.swift
//
//
// Created by scchn on 2020/5/18.
// Copyright © 2020 scchn. All rights reserved.
//
import Foundation
@scchn
scchn / NSBezierPath+CGPath.swift
Created April 23, 2020 12:58 — forked from lukaskubanek/NSBezierPath+CGPath.swift
NSBezierPath+CGPath.swift
import AppKit
public extension NSBezierPath {
public convenience init(path: CGPath) {
self.init()
let pathPtr = UnsafeMutablePointer<NSBezierPath>.alloc(1)
pathPtr.initialize(self)
@scchn
scchn / refresh_cameras.sh
Created March 29, 2020 10:21 — forked from joshavant/refresh_cameras.sh
macOS Refresh Cameras Script
#!/bin/bash
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
echo "Killing VDCAssistant..."
sudo killall VDCAssistant
echo "Killing AppleCameraAssistant..."