This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Usage | |
// recaman(size: 10) | |
// ouput: [0, 1, 3, 6, 2, 7, 13, 20, 12, 21] | |
import Foundation | |
func recaman(size: Int) -> [Int] { | |
var res = [Int]() | |
var counter = 1 | |
var currNumber = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
struct DraggableView<Content>: View where Content: View { | |
var onDrop: () -> Void | |
var content: Content | |
@State private var offset: CGSize = .zero | |
init(onDrop: @escaping () -> Void, content: @escaping () -> Content) { | |
self.onDrop = onDrop | |
self.content = content() |