Comments (2)
How can we resolve this? It seems as though modifying the extension-facing API to support both types of input is the most future-proof course of action
I haven’t watched the session yet, but I did read your notes on it. This seems like an appropriate, if slightly inelegant way to go. I like a lot better than either of these...
- Go iOS 9 only and not be useful to anyone who needs to support iOS 8 for a while still (bad option, almost no one will use this)
- Forget about changing the library in the future to better mesh with how activity items work in a post-iOS 9 world (makes this library very useful in the short term but more annoying to use than it needs to be post-iOS 9)
from xextensionitem.
I actually dreamt about this last night. How sad is that?
I think on the extension side, we’d want our custom class to wrap the extension context rather than an individual item. We would no longer be providing a cleaner API on top of NSExtensionItem
on the extension side, but we’d be able to provide a uniform API – an array of NSExtensionItem
instances and some metadata – regardless of if the input was structured the old way (one XExtensionItemSource
) or the new way (a bunch of raw input items plus one XExtensionItemSource
.
The new class would look something like this:
@interface XExtensionItemContext : NSObject
/**
@see `NSExtensionContext`
*/
@property (nonatomic, readonly) NSArray/*<NSExtensionItem>*/ *inputItems;
/**
@see `XExtensionItemSource`
*/
@property (nonatomic, readonly) NSArray/*<NSString>*/ *tags;
/**
@see `XExtensionItemSource`
*/
@property (nonatomic, readonly) XExtensionItemReferrer *referrer;
/**
@see `XExtensionItemSource`
*/
@property (nonatomic, readonly) NSDictionary *userInfo;
/**
Inialize a new instance with an incoming `NSExtensionContext`.
@param extensionItemContext Extension context.
@return New instance populated with the extension context.
*/
- (instancetype)initWithExtensionContext:(NSExtensionContext *)extensionContext NS_DESIGNATED_INITIALIZER;
@end
Title and attributed content text would no longer be something that XExtensionItem
concerns itself with, since it would now be augmenting one or more NSExtensionItem
instances, rather than expecting to be used in place of them. In short, I think this makes the API slightly less nice in the short term but much more future-proof.
I have an in-progress branch that makes these changes that I’ll happily link to from this issue once I’ve got it a little further along. In the meantime, feedback welcome!
from xextensionitem.
Related Issues (20)
- Consider renaming typeIdentifiersToContentRepresentations
- appName property logic should default to bundle display name.
- Add Tumblr custom parameters object, figure out subspec structure HOT 1
- Add pod lib linting back to `.travis.yml` once a CocoaPods supports JSON spec linting
- Take another pass at the README and header docs before 1.0
- Add the ability to provide alternative items on a per-activity type basis HOT 7
- Consider adding `alternateContentRepresentations` back
- Add hooks for `UIActivityItemSource`’s optional methods
- Add nullability attributes once Travis CI supports Xcode 6.3
- Determine whether or not the system Weibo activities can support `NSExtensionItem` input HOT 1
- Allow `attributedContentText` to be configured on a per-activity type basis HOT 1
- Allow a default `subject` to be provided HOT 4
- Carthage support
- XExtensionItemSource API is Too Complicated HOT 17
- Should provider types return `id` types? HOT 1
- Logo in README is not retina
- Consider supporting iOS 7 HOT 6
- There isn’t currently a way to lazily return (typed) `NSData` from a provider block
- Should be able to specify titles on a per-activity type basis
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xextensionitem.