Skip to content
This repository has been archived by the owner on Aug 14, 2019. It is now read-only.

Added ability to intercept -[UITextView paste:] #1136

Merged
merged 6 commits into from Aug 14, 2015
Merged

Added ability to intercept -[UITextView paste:] #1136

merged 6 commits into from Aug 14, 2015

Conversation

harlanhaskins
Copy link
Collaborator

Added JSQComposerTextViewDelegate with optional method for intercepting pastes.
Added demo to demo app of pasting an image from the UIPasteboard.

…r intercepting pastes.

Added demo to demo app of pasting an image from the UIPasteboard.
@harlanhaskins
Copy link
Collaborator Author

Not quite sure why that build failed. It's some weird issue with DerivedData...

@jessesquires
Copy link
Owner

@harlanhaskins - nice! 👍

@jessesquires jessesquires added this to the Release 7.1.2 milestone Aug 4, 2015
* A delegate used to forward custom notifications from `JSQMessagesComposerTextView`.
*/
@protocol JSQMessagesComposerTextViewDelegate <NSObject>
@optional
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's make this non-optional.

@harlanhaskins
Copy link
Collaborator Author

My thought was that the delegate could be used for more than just pasting, but I'll definitely make those changes first thing tomorrow. I'm using this fork for Bryx 911 now and it's working great!

@jessesquires
Copy link
Owner

  1. left a few comments to address.
  2. don't worry about travis-ci, i'll look into. it's been borked lately

@jessesquires
Copy link
Owner

@harlanhaskins - awesome! 👍

Regarding optional vs non-optional delegates: there are basically 2 methods to solve this kind of problem.

  1. Having optional methods
  2. Dividing up a protocol into multiple protocols (i.e., delegates).

With (2), you can achieve optionality by allowing the delegate to be nil. Good article by Ash, here: http://ashfurrow.com/blog/protocols-and-swift/

@wdcurry
Copy link

wdcurry commented Aug 4, 2015

I luv the way you bork a repo ;)
"don't worry about travis-ci, i'll look into. it's been borked lately"

@jessesquires
Copy link
Owner

@wdcurry 😆

Updated the demo for the new naming.
@harlanhaskins
Copy link
Collaborator Author

I went ahead and updated it. Should be ready to merge!

@@ -18,6 +18,8 @@

#import "DemoMessagesViewController.h"

@interface DemoMessagesViewController () <JSQMessagesComposerTextViewPasteDelegate>
@end
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's move this to the header file.

@jessesquires
Copy link
Owner

Hey @harlanhaskins ! I was about to merge and noticed a couple more changes.

Also, for doc comments, there should be 2 spaces after the *.

/**
*  Two spaces after the *
*  For each of
*  These lines :)  
*/

After this, I'll merge! 😄 Thanks again! 👍

@jessesquires
Copy link
Owner

Thanks @harlanhaskins ! 😄 🎉

jessesquires added a commit that referenced this pull request Aug 14, 2015
Added ability to intercept -[UITextView paste:]
@jessesquires jessesquires merged commit 6405d7d into jessesquires:develop Aug 14, 2015
@jessesquires
Copy link
Owner

@harlanhaskins - Just tested. This is awesome.

img

Submit more PRs plz. 😁

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

Successfully merging this pull request may close these issues.

None yet

3 participants