Skip to content

Instantly share code, notes, and snippets.

Avatar

Bruno Bilescky brunogb

  • Badoo
  • London, UK
View GitHub Profile
View macOS.swift
import SwiftUI
import PlaygroundSupport
struct Desktop: View {
var body: some View {
ZStack {
// Image(uiImage: #imageLiteral(resourceName: "IMG_6281.JPG"))
Color(UIColor.systemBlue)
macOS()
}
@brunogb
brunogb / SwiftUIDragDrop.swift
Last active Jul 1, 2020
Drag'n'Drop with SwiftUI
View SwiftUIDragDrop.swift
import SwiftUI
import PlaygroundSupport
struct MyView: View {
@State var viewOffset: CGSize = .zero {
didSet {
let newFrame = viewFrame.offsetBy(dx: self.viewOffset.width, dy: self.viewOffset.height)
self.canDrop = containerFrame.intersects(newFrame)