Skip to content

Instantly share code, notes, and snippets.

View StefKors's full-sized avatar
📟

Stef Kors StefKors

📟
View GitHub Profile
@StefKors
StefKors / DraggableView.swift
Created July 31, 2021 14:58 — forked from ohayon/DraggableView.swift
Example of making a reusable `draggable()` modifier for SwiftUI Views
struct DraggablePita: View {
var body: some View {
Image(uiImage: UIImage(named: "pita.png")!)
.draggable() // Add the new, custom modifier to make this draggable
}
}
// Handle dragging
struct DraggableView: ViewModifier {
@State var offset = CGPoint(x: 0, y: 0)
export type BaseCountry = {
// the ISO 3166-1 code for the country
code: string
// the name of the country (in english)
name: string
// the raw emoji for the country's flag (can be multiple codepoints)
emoji: string
// the international dialing code for the country (without the `+` prefix or escape codes)
dial_country_code: string
// the regions codes, if any