Attach objects in SwiftUI

Hi there!
I want to attach 2 objects in SwiftUI when they'll near.

import SwiftUI

struct ContentView: View {
    @State private var dragOffset: CGSize = .zero
    @State private var position: CGSize = .zero
    var body: some View{
        Circle()
            .frame(width: 140, height: 140)
            .foregroundColor(.green)
            .position(x: 150, y: 90)
            .offset(x: dragOffset.width + position.width, y: dragOffset.height)
            .gesture(DragGesture()
                        .onChanged({ (value) in 
                            self.dragOffset = value.translation
                        })
            )

        Circle()
            .frame(width: 140, height: 140)
            .foregroundColor(.blue)
            .position(x: 500, y: 210)
        Circle()
            .frame(width: 140, height: 140)
            .foregroundColor(.orange)
            .position(x: 90, y: 70)
    }
}

In my code I want to stick the green circle with one of the other 2, when it is close to them. Can anyone help me figure out this?

Thanks in advance.

Attach objects in SwiftUI
 
 
Q