Summary text.
Hello World, how is it going?
#if os(iOS) | |
import UIKit | |
#else | |
import AppKit | |
#endif | |
let view = UIView(frame: CGRectMake(0, 0, 400, 300)) | |
view.backgroundColor = UIColor.redColor() | |
let button = UIButton(type: .Custom) |
Hello World, how is it going?
import AppKit | |
public extension NSBezierPath { | |
public 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 { |
a: AM/PM | |
A: 0~86399999 (Millisecond of Day) | |
c/cc: 1~7 (Day of Week) | |
ccc: Sun/Mon/Tue/Wed/Thu/Fri/Sat | |
cccc: Sunday/Monday/Tuesday/Wednesday/Thursday/Friday/Saturday | |
d: 1~31 (0 padded Day of Month) | |
D: 1~366 (0 padded Day of Year) | |
#!/bin/sh | |
defaults read com.apple.finder CreateDesktop > /dev/null 2>&1 | |
enabled=$? | |
if [ "$1" = "off" ]; then | |
if [ $enabled -eq 1 ]; then | |
defaults write com.apple.finder CreateDesktop false | |
osascript -e 'tell application "Finder" to quit' | |
open -a Finder |
import Cocoa | |
import MetalKit | |
@NSApplicationMain | |
class AppDelegate: NSObject, NSApplicationDelegate, MTKViewDelegate { | |
weak var window: NSWindow! | |
weak var metalView: MTKView! | |
let device = MTLCreateSystemDefaultDevice()! | |
var commandQueue: MTLCommandQueue! | |
var pipelineState: MTLRenderPipelineState! |
Of the many tools available for fuzzing, I've found that LLVM's libfuzzer is the easiest to use for Swift on macOS. Other tools seem to have a list of requirements taht are difficult to meet. libfuzzer on the other hand is built into LLVM and is available on macOS in the custom Swift toolchains: https://www.swift.org/download/
In this document I'll describe how to use libfuzzer with Swift and Swift Packages.
I used this setup to fuzz an SVG Renderer package that I am building. I was able to find and fix a number of bugs in my SVG parsing code using libfuzzer in basically no time at all.