scenee / FloatingPanel

A clean and easy-to-use floating panel UI component for iOS
MIT License
5.58k stars 505 forks source link

Pass data from UIViewController to floatingPanel #500

Open ysavr opened 2 years ago

ysavr commented 2 years ago

Hello, how to send data from uiViewCOntroller to floatingPanel and displayed to label in floating panel ?

guard let bottomSheetVc = storyboard?.instantiateViewController(identifier: Constant.storyBoard.sbSheetExercise) as? BottomSheetExerciseViewController
        else {
            return
        }
        bottomSheetVc.coordinate(lat: lat, lng: lng)

func coordinate(lat: Double!, lng: Double!){
        let latString: String = String(format: "%f", lat)
        let lngString: String = String(format: "%f", lng)

        self.lblDistanse.text = "self.lblDistanse.text = latString

    }

it's return nil when display to label

Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional value: file

scenee commented 2 years ago

The above code is not enough to understand your situation. But If uiViewControeller is a content view controller in a panel, you can access it through uiViewController.parent.