Skip to content

Instantly share code, notes, and snippets.

//
// ContentView.swift
// Widgets
//
// Created by Kyle Halevi on 7/3/20.
//
import SwiftUI
struct Widget: View {
import SwiftUI
import PlaygroundSupport
struct ContentView: View {
var body: some View {
/*Terminal*/
VStack {
import SwiftUI
import MapKit
import PlaygroundSupport
struct Location {
var title: String
var latitude: Double
var longitude: Double
}
import SwiftUI
import PlaygroundSupport
// constants
let cardWidth: CGFloat = 343
let cardHeight: CGFloat = 212
let spacing = 36
let animation = Animation.spring()
let cardColors = [
Color(UIColor.systemRed),
@kylehowells
kylehowells / Speedo.swift
Created June 28, 2020 17:37
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: [
@dduan
dduan / SpeakBubble.swift
Last active June 20, 2020 13:56
Twitter's voice tweet UI has an interesting animation on iOS. This is an attempt to recreate that animation with SwiftUI. Looks like this https://youtu.be/I6XZzIgWYAQ
import SwiftUI
struct ChaoticPhoto: View {
let image: Image
let radius: CGFloat
@Binding var activated: Bool
@State var scale: CGFloat = 1
var body: some View {
image
.resizable()
@laurenchen0631
laurenchen0631 / CustomTextField.swift
Last active June 30, 2024 14:02
Swiftui CustomTextField
// customized text field based on @Anshuman Singh https://stackoverflow.com/questions/58311022/autofocus-textfield-programmatically-in-swiftui
import SwiftUI
struct CustomTextField: UIViewRepresentable {
class Coordinator: NSObject, UITextFieldDelegate {
@Binding var textInput: String
@Binding var nextResponder: Bool?
@Binding var isResponder: Bool?
var maxLength: Int?
import RxSwift
import RxCocoa
@dynamicMemberLookup
protocol DynamicMemberLookupableObservableType: AssociateObservable {
subscript<T>(dynamicMember keyPath: KeyPath<Value, T>) -> Observable<T> { get }
}
extension DynamicMemberLookupableObservableType {
subscript<T>(dynamicMember keyPath: KeyPath<Value, T>) -> Observable<T> {
@chriseidhof
chriseidhof / boilerplate.swift
Last active April 17, 2025 11:08
QuickMacApp
// 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))
@xtabbas
xtabbas / SnapCarousel.swift
Created May 10, 2020 18:13
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