Skip to content

Instantly share code, notes, and snippets.

@minsOne
minsOne / sample.swift
Created February 11, 2020 02:28 — forked from chriseidhof/viewmirror.swift
View Inspection
import SwiftUI
struct SizeKey: PreferenceKey {
static func reduce(value: inout CGSize?, nextValue: () -> CGSize?) {
value = value ?? nextValue()
}
}
struct ContentView: View {
@State var width: CGFloat? = nil
var body: some View {
@minsOne
minsOne / Demo.swift
Created February 11, 2020 05:25 — forked from AliSoftware/Demo.swift
NestableCodingKey: Nice way to define nested coding keys for properties
struct Contact: Decodable, CustomStringConvertible {
var id: String
@NestedKey
var firstname: String
@NestedKey
var lastname: String
@NestedKey
var address: String
enum CodingKeys: String, NestableCodingKey {
@minsOne
minsOne / build-xcframework.sh
Created April 20, 2020 08:29 — forked from quangDecember/build-xcframework.sh
Build XCFramework (universal) framework, create new Aggregate target, add to New Run Script Phase
env > env.txt
instruments -s devices > devices.txt
#! /bin/sh -e
# This script demonstrates archive and create action on frameworks and libraries
# Based on script by @author Boris Bielik
# Release dir path
OUTPUT_DIR_PATH="${PROJECT_DIR}/XCFramework"
function archivePathSimulator {
@minsOne
minsOne / SnapCarousel.swift
Created May 15, 2020 05:53 — forked from xtabbas/SnapCarousel.swift
A carousel that snap items in place build on top of SwiftUI
//
// SnapCarousel.swift
// prototype5
//
// Created by xtabbas on 5/7/20.
// Copyright © 2020 xtadevs. All rights reserved.
//
import SwiftUI
// Run any SwiftUI view as a Mac app.
import Cocoa
import SwiftUI
NSApplication.shared.run {
VStack {
Text("Hello, World")
.padding()
.background(Capsule().fill(Color.blue))
@minsOne
minsOne / Speedo.swift
Created July 2, 2020 01:18 — forked from kylehowells/Speedo.swift
Scifi Style Speedometer Concept in SwiftUI
import SwiftUI
struct ContentView: View {
let backgroundGradient = Gradient(colors: [
Color(red: 65.0/255.0, green: 65.0/255.0, blue: 84.0/255.0, opacity: 1.0),
Color(red: 20.0/255.0, green: 20.0/255.0, blue: 24.0/255.0, opacity: 1.0)
])
let blueGradient = Gradient(colors: [
import SwiftUI
import MapKit
import PlaygroundSupport
struct Location {
var title: String
var latitude: Double
var longitude: Double
}
import SwiftUI
import PlaygroundSupport
struct ContentView: View {
var body: some View {
/*Terminal*/
VStack {
import SwiftUI
import PlaygroundSupport
struct ContentView: View {
var body: some View {
/*Terminal*/
VStack {