Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ambiguous use of 'isEnabled' #30

Open
AnkurLahiry opened this issue Feb 17, 2020 · 2 comments
Open

Ambiguous use of 'isEnabled' #30

AnkurLahiry opened this issue Feb 17, 2020 · 2 comments

Comments

@AnkurLahiry
Copy link

While adding image using attachment manager, I found this error message
messageInputBar

@gwynantj
Copy link

@AnkurLahiry could you provide some more code please? From what I can see there is nothing wrong with that code.

i.e. where is messageInputBar defined etc

@AnkurLahiry
Copy link
Author

AnkurLahiry commented Feb 18, 2020

Sure!

for all (My Project, MessageKit and MessageInputBar) SWIFT_VERSION = 5.0

class ChatViewController: MessagesViewController {
     override func viewDidLoad() {
           super.viewDidLoad()
            prepareMessageChatViewController()
    }
     private func prepareMessageChatViewController() {
        prepareMessageView()
        prepareMessageInputBar()
    }
    
    private func prepareMessageView() {
        messagesCollectionView.messageCellDelegate = self
        messagesCollectionView.messagesDataSource = self
        messagesCollectionView.messagesLayoutDelegate = self
        messageInputBar.delegate = self
        messagesCollectionView.messagesDisplayDelegate = self
        if let layout = messagesCollectionView.collectionViewLayout as? MessagesCollectionViewFlowLayout {
            layout.setMessageIncomingAvatarPosition(.init(vertical: .messageCenter))
            layout.setMessageOutgoingAvatarPosition(.init(vertical: .messageCenter))
        }
        maintainPositionOnKeyboardFrameChanged = true
        messagesCollectionView.showsVerticalScrollIndicator = false 
    }
    
    private func prepareMessageInputBar() {
        messageInputBar.setMiddleContentView(messageInputBar.inputTextView, animated: false)
        messageInputBar.setRightStackViewWidthConstant(to: 52, animated: false)
        let bottomItems = [cameraItem, galleryItem, .flexibleSpace] // some custom items
        messageInputBar.setStackViewItems(bottomItems, forStack: .bottom, animated: false)
        messageInputBar.sendButton.activityViewColor = GLOBAL_TINT_COLOR
        messageInputBar.sendButton.backgroundColor = UIColor.white
        messageInputBar.sendButton.layer.cornerRadius = 10
        messageInputBar.sendButton.setTitleColor(GLOBAL_TINT_COLOR, for: .normal)
        messageInputBar.sendButton.setTitleColor(UIColor.lightGray, for: .highlighted)
        messageInputBar.sendButton.setTitleColor(GLOBAL_TINT_COLOR, for: .disabled)
        messageInputBar.sendButton
            .onSelected { item in
                item.transform = CGAffineTransform(scaleX: 1.05, y: 1.05)
            }.onDeselected { item in
                item.transform = .identity
        }
        messageInputBar.shouldManageSendButtonEnabledState = true
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants