MessageKit / MessageInputBar

A powerful InputAccessoryView ideal for messaging applications
MIT License
64 stars 44 forks source link

Value of type 'InputItem' has no member 'isEnabled' #28

Closed hechukwu closed 5 years ago

hechukwu commented 5 years ago

I want to disable the leftStackViewItem when sending a photo, so I do this self.messageInputBar.leftStackViewItems.forEach { item in item.isEnabled = !self.isSendingPhoto } but I get this error Value of type 'InputItem' has no member 'isEnabled'

isupremedyou commented 5 years ago

InputBarButtonItem is a subclass of UIButton and conforms to the protocol InputItem. So long as your left stack view items are all InputBarButtonItem then you can try casting them: as? InputBarButtonItem and that should resolve your error.

hechukwu commented 5 years ago

Thank you @travischapman for your help, you saved me days of debugging.

emmismtv commented 4 years ago

So what would be the final code? Still new is this kind of things.

hechukwu commented 4 years ago

self.messageInputBar.leftStackViewItems.forEach { item in guard let item = item as? InputBarButtonItem else { return } item.isEnabled = !self.isSendingPhoto }

emmismtv commented 4 years ago

Thanks!