C4iOS
C4iOS copied to clipboard
React-native import
I'm pretty new to Swift, so please bare with!
Is it possible with c4 to 'export' as a project (I think with a .framework...?), to be imported into other xcode projects?
I've been referencing Swift -> React Native via this tutorial http://browniefed.com/blog/react-native-how-to-bridge-a-swift-view/
However am unsure whether C4 can be used like this, or whether it was intended for standalone use only.
Hey boyswan, I haven't had a look at react-native. I'll read through this article tonight and post an answer.
Apologies for the long delay in responding to your question. I was on vacation for a few weeks, and then took some time to get caught up with everything.
From what I see on the tutorial you linked, C4 can be used like this.
We actually suggest building your projects by compiling C4 into a framework, so we're already achieving this step.
The real work is in creating the bindings... i.e. everything that allows you to get to doing this kind of stuff:
import React, { requireNativeComponent, processColor } from 'react-native';
let RNLinearGradient = requireNativeComponent('RNLinearGradientSwift', LinearGradient);
class LinearGradient extends React.Component {
render() {
let { colors, ...otherProps } = this.props;
return <RNLinearGradient {...otherProps} colors={processColor(colors)} />;
}
}
LinearGradient.propTypes = {
colors: React.PropTypes.array.isRequired,
locations: React.PropTypes.array,
}
export default LinearGradient;
I'd love to see C4 working with react native.