Hi all I'm creating a chat app, using firebase.
when I get to the screen to create a channel it crashes saying found nil while unwrapping optional value. If i go back into the app the channel has been created so i presume it is finding nil when changing viewcontrolers and there must be nothing in the database for the new channel under messages. below is the code and where it crashes.
var channelRef: FIRDatabaseReference?
private lazy var messageRef: FIRDatabaseReference = self.channelRef!.child("messages")
then it crashes here...
private func observeMessages() {
messageRef = channelRef!.child("messages")
this function is called on view did load