Skip to content

Instantly share code, notes, and snippets.

@Noitidart
Last active July 5, 2017 03:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Noitidart/42143e9944826a52fe92155b81ba7cc5 to your computer and use it in GitHub Desktop.
Save Noitidart/42143e9944826a52fe92155b81ba7cc5 to your computer and use it in GitHub Desktop.
import Foundation
import UIKit
import SpreadsheetView
class SampleView: UIView {
let label = UILabel(frame: CGRect(x: 0, y: 0, width: 150, height: 50))
private var _txt: String = "This is swift"
override init(frame: CGRect) {
super.init(frame: frame)
self.label.text = "This is SWIFT"
self.addSubview(self.label)
let controller = ViewController();
self.addSubview(controller.view);
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
var txt: NSString? {
set {
if newValue != nil {
self._txt = newValue! as String;
//self.setNeedsDisplay();
self.label.text = self._txt;
}
}
get {
return nil;
}
}
}
import Foundation
@objc(SampleViewManager)
class SampleViewManager : RCTViewManager {
override func view() -> UIView! {
return SampleView();
}
}
#import <Foundation/Foundation.h>
#import <React/RCTView.h>
@interface SampleViewModule : RCTView
@property (nonatomic, assign) NSString *txt;
@end
#import <React/RCTBridgeModule.h>
#import <React/RCTViewManager.h>
#import "SampleViewModule.h"
@interface RCT_EXTERN_MODULE(SampleViewManager, RCTViewManager)
RCT_EXPORT_VIEW_PROPERTY(txt, NSString);
@end
#import "React/RCTViewManager.h"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment