Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import Foundation
import UIKit
let point = CGPoint(x: 1.0, y: 2.0)
if let data = try? JSONEncoder().encode(point) {
String(data: data, encoding: String.Encoding.utf8)
}
let size = CGSize(width: 3.0, height: 4.0)
if let data = try? JSONEncoder().encode(size) {
String(data: data, encoding: String.Encoding.utf8)
}
let rect = CGRect(origin: point, size: size)
if let data = try? JSONEncoder().encode(rect) {
String(data: data, encoding: String.Encoding.utf8)
}
let vector = CGVector(dx: 5.0, dy: 6.0)
if let data = try? JSONEncoder().encode(vector) {
String(data: data, encoding: String.Encoding.utf8)
}
let affineTransform = CGAffineTransform(a: 7.0, b: 8.0, c: 9.0, d: 10.0, tx: 11.0, ty: 12.0)
if let data = try? JSONEncoder().encode(affineTransform ) {
String(data: data, encoding: String.Encoding.utf8)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.