I am using SWiftui and Xcode 16.2 and I am trying to get a region but getting this error . I have been searching around to see how I can resolve this but no luck
'let' binding pattern cannot appear in an expression
This is my first time trying this and I have a simple code
import Foundation
import SwiftUI
import CoreLocation
import MapKit
import UIKit
func getRegion(from position: MapCameraPosition) -> MKCoordinateRegion? {
var result: MKCoordinateRegion? = nil
switch position {
case .region(let region):
result = region
default:
break
}
return result
}