This is a curated list of iOS (Swift & ObjC) frameworks which are inspired by React and Elm.
- ReactSwift by @ColinEberhardt
- https://github.com/ColinEberhardt/ReactSwift
This is a curated list of iOS (Swift & ObjC) frameworks which are inspired by React and Elm.
Based on the example file from the announcement blog post http://sketchplugins.com/d/87-new-file-format-in-sketch-43
type UUID = string // with UUID v4 format
type SketchPositionString = string // '{0.5, 0.67135115527602085}'
type SketchNestedPositionString = string // '{{0, 0}, {75.5, 15}}'
class Number /* class cluser */ { | |
class Int8: Number { | |
var value: Swift.Int8 | |
init(_ value: Swift.Int8) { self.value = value } | |
} | |
class Int: Number { | |
var value: Swift.Int | |
init(_ value: Swift.Int) { self.value = value } | |
} |
import UIKit | |
import GLKit | |
extension Float { | |
var radians: Float { | |
return GLKMathDegreesToRadians(self) | |
} | |
} | |
class Matrix4 { |
// Scanner+Swift.swift | |
// | |
// A set of idiomatic swift extensions to Scanner | |
// | |
// Based on https://gist.github.com/natecook1000/59bb0c9117b555f5d40d | |
// Converted to Swift 3 | |
// | |
import Foundation |
public func projectFunctionToCoordinateSystem(function f: FunctionType) -> (p0: CGPoint, p1: CGPoint) -> (x: CGFloat) -> CGPoint { | |
return { p0, p1 in | |
return { x in | |
let (dx, dy) = (p1.x - p0.x, p1.y - p0.y) | |
let (magnitude, theta) = (hypot(dy, dx), atan2(dy, dx)) // Thanks loooop | |
var outPoint = CGPoint(x: x * magnitude, y: f(x) * magnitude) | |
outPoint = CGPointApplyAffineTransform(outPoint, CGAffineTransformMakeRotation(theta)) | |
outPoint = CGPointApplyAffineTransform(outPoint, CGAffineTransformMakeTranslation(p0.x, p0.y)) | |
return CGPoint(x: outPoint.x, y: outPoint.y) | |
} |
SELECT | |
m.rowid as message_id, | |
(SELECT chat_id FROM chat_message_join WHERE chat_message_join.message_id = m.rowid) as message_group, | |
CASE p.participant_count | |
WHEN 0 THEN "???" | |
WHEN 1 THEN "Individual" | |
ELSE "Group" | |
END AS chat_type, | |
DATETIME(date +978307200, 'unixepoch', 'localtime') AS date, | |
CASE is_from_me |
Because pointers can be ugh
To understand a pointer, let's review "regular" variables first. If you're familiar with a programming language without pointers like JavaScript, this is what you think when you hear "variable".
When declaring a variable by identifier (or name), the variable is synonymous with its value.
#!/usr/bin/env xcrun swift -i | |
import Foundation | |
import Darwin.ncurses | |
initscr() // Init window. Must be first | |
cbreak() | |
noecho() // Don't echo user input | |
nonl() // Disable newline mode | |
intrflush(stdscr, true) // Prevent flush |