Skip to content

Instantly share code, notes, and snippets.

@dcalhoun
Last active November 1, 2018 15:49
Show Gist options
  • Save dcalhoun/a504a369b1c1f0c863a21a5fda2bc9ac to your computer and use it in GitHub Desktop.
Save dcalhoun/a504a369b1c1f0c863a21a5fda2bc9ac to your computer and use it in GitHub Desktop.
React Native Swift UI Module
import Foo from './Foo';
import React, { Component } from 'react';
export default class App extends Component {
render() {
return (
<Foo autostart={true} file="http://example.com" />
);
}
}
import PropTypes from 'prop-types';
import React, { Component } from 'react'
import { ViewPropTypes, requireNativeComponent } from 'react-native'
const Foo = requireNativeComponent('Foo', FooView)
export default class FooView extends Component {
render () {
return <Foo {...this.props} />
}
}
FooView.propTypes = {
autostart: PropTypes.bool,
file: PropTypes.string,
}
import Foundation
@objc(FooManager)
class FooManager: RCTViewManager {
override func view() -> UIView! {
return Foo()
}
override static func requiresMainQueueSetup() -> Bool {
return true
}
}
@interface RCT_EXTERN_MODULE(FooManager, RCTViewManager)
RCT_EXPORT_VIEW_PROPERTY(autostart, BOOL);
RCT_EXPORT_VIEW_PROPERTY(file, NSString);
@end
#import "React/RCTBridgeModule.h"
#import "React/RCTViewManager.h"
#import <FooSDK/FooController.h>
import UIKit
class Foo: UIView, FooDelegate {
private var foo: FooController!
@objc var autostart:Bool = false
@objc var file:String? {
get { return foo.config.file }
set(file) {
foo.config.file = file
}
}
override init(frame: CGRect) {
super.init(frame: frame)
createFoo()
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func createFoo() {
let config: Config = Config()
config.autostart = autostart
foo = FooController(config: config)
foo.delegate = self
}
}
2018-11-01 10:41:50.048 [info][tid:main][RCTCxxBridge.mm:216] Initializing <RCTCxxBridge: 0x6000016303c0> (parent: <RCTBridge: 0x6000002117a0>, executor: (null))
2018-11-01 10:41:50.050578-0500 Proj[71797:13068435] Initializing <RCTCxxBridge: 0x6000016303c0> (parent: <RCTBridge: 0x6000002117a0>, executor: (null))
2018-11-01 10:41:50.138 [info][tid:main][RCTRootView.m:293] Running application Proj ({
initialProps = {
};
rootTag = 1;
})
2018-11-01 10:41:50.137739-0500 Proj[71797:13068435] Running application Proj ({
initialProps = {
};
rootTag = 1;
})
2018-11-01 10:41:50.165444-0500 Proj[71797:13068847] [] nw_socket_handle_socket_event [C4.1:1] Socket SO_ERROR [61: Connection refused]
2018-11-01 10:41:50.170837-0500 Proj[71797:13068847] [] nw_socket_handle_socket_event [C4.2:1] Socket SO_ERROR [61: Connection refused]
2018-11-01 10:41:50.173132-0500 Proj[71797:13068842] [] nw_connection_get_connected_socket [C4] Client called nw_connection_get_connected_socket on unconnected nw_connection
2018-11-01 10:41:50.529687-0500 Proj[71797:13068846] [] nw_socket_handle_socket_event [C5.1:1] Socket SO_ERROR [61: Connection refused]
2018-11-01 10:41:50.531649-0500 Proj[71797:13068846] [] nw_socket_handle_socket_event [C5.2:1] Socket SO_ERROR [61: Connection refused]
2018-11-01 10:41:50.533047-0500 Proj[71797:13068862] [] nw_connection_get_connected_socket [C5] Client called nw_connection_get_connected_socket on unconnected nw_connection
2018-11-01 10:41:50.661 [info][tid:com.facebook.react.JavaScript] Running application "Proj" with appParams: {"rootTag":1,"initialProps":{}}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF
2018-11-01 10:41:50.661159-0500 Proj[71797:13068852] Running application "Proj" with appParams: {"rootTag":1,"initialProps":{}}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF
2018-11-01 10:41:50.717683-0500 Proj[71797:13068846] Error loading /Library/Audio/Plug-Ins/HAL/BartenderAudioPlugIn.plugin/Contents/MacOS/BartenderAudioPlugIn: dlopen(/Library/Audio/Plug-Ins/HAL/BartenderAudioPlugIn.plugin/Contents/MacOS/BartenderAudioPlugIn, 262): no suitable image found. Did find:
/Library/Audio/Plug-Ins/HAL/BartenderAudioPlugIn.plugin/Contents/MacOS/BartenderAudioPlugIn: mach-o, but not built for iOS simulator
2018-11-01 10:41:50.717841-0500 Proj[71797:13068846] Cannot find function pointer New_SHP_PlugIn for factory <CFUUID 0x600002947be0> 834FC054-C1CC-11D6-BD01-00039315CD46 in CFBundle/CFPlugIn 0x7fb94e51aa50 </Library/Audio/Plug-Ins/HAL/BartenderAudioPlugIn.plugin> (bundle, not loaded)
2018-11-01 10:41:53.082160-0500 Proj[71797:13068862] [] nw_socket_handle_socket_event [C6.1:1] Socket SO_ERROR [61: Connection refused]
2018-11-01 10:41:53.084652-0500 Proj[71797:13068862] [] nw_socket_handle_socket_event [C6.2:1] Socket SO_ERROR [61: Connection refused]
2018-11-01 10:41:53.086256-0500 Proj[71797:13068837] [] nw_connection_get_connected_socket [C6] Client called nw_connection_get_connected_socket on unconnected nw_connection
2018-11-01 10:41:53.285048-0500 Proj[71797:13068837] [] nw_socket_handle_socket_event [C7.1:1] Socket SO_ERROR [61: Connection refused]
2018-11-01 10:41:53.286907-0500 Proj[71797:13068837] [] nw_socket_handle_socket_event [C7.2:1] Socket SO_ERROR [61: Connection refused]
2018-11-01 10:41:53.288237-0500 Proj[71797:13068846] [] nw_connection_get_connected_socket [C7] Client called nw_connection_get_connected_socket on unconnected nw_connection
2018-11-01 10:41:53.913084-0500 Proj[71797:13068838] [AudioHAL_Client] AudioHardware.cpp:1210:AudioObjectRemovePropertyListener: AudioObjectRemovePropertyListener: no object with given ID 0
2018-11-01 10:41:53.913095-0500 Proj[71797:13068861] [AudioHAL_Client] AudioHardware.cpp:1210:AudioObjectRemovePropertyListener: AudioObjectRemovePropertyListener: no object with given ID 0
2018-11-01 10:41:53.913341-0500 Proj[71797:13068861] [AudioHAL_Client] AudioHardware.cpp:1210:AudioObjectRemovePropertyListener: AudioObjectRemovePropertyListener: no object with given ID 0
2018-11-01 10:41:53.913341-0500 Proj[71797:13068838] [AudioHAL_Client] AudioHardware.cpp:1210:AudioObjectRemovePropertyListener: AudioObjectRemovePropertyListener: no object with given ID 0
2018-11-01 10:41:53.913439-0500 Proj[71797:13068861] [AudioHAL_Client] AudioHardware.cpp:1210:AudioObjectRemovePropertyListener: AudioObjectRemovePropertyListener: no object with given ID 0
2018-11-01 10:41:53.913454-0500 Proj[71797:13068838] [AudioHAL_Client] AudioHardware.cpp:1210:AudioObjectRemovePropertyListener: AudioObjectRemovePropertyListener: no object with given ID 0
2018-11-01 10:41:53.913948-0500 Proj[71797:13068861] [AudioHAL_Client] AudioHardware.cpp:1210:AudioObjectRemovePropertyListener: AudioObjectRemovePropertyListener: no object with given ID 0
2018-11-01 10:41:53.913972-0500 Proj[71797:13068838] [AudioHAL_Client] AudioHardware.cpp:1210:AudioObjectRemovePropertyListener: AudioObjectRemovePropertyListener: no object with given ID 0
2018-11-01 10:41:53.914053-0500 Proj[71797:13068861] [AudioHAL_Client] AudioHardware.cpp:1210:AudioObjectRemovePropertyListener: AudioObjectRemovePropertyListener: no object with given ID 0
2018-11-01 10:41:53.914220-0500 Proj[71797:13068838] [AudioHAL_Client] AudioHardware.cpp:1210:AudioObjectRemovePropertyListener: AudioObjectRemovePropertyListener: no object with given ID 0
2018-11-01 10:41:53.914401-0500 Proj[71797:13068861] [AudioHAL_Client] AudioHardware.cpp:1210:AudioObjectRemovePropertyListener: AudioObjectRemovePropertyListener: no object with given ID 0
2018-11-01 10:41:53.914578-0500 Proj[71797:13068838] [AudioHAL_Client] AudioHardware.cpp:1210:AudioObjectRemovePropertyListener: AudioObjectRemovePropertyListener: no object with given ID 0
2018-11-01 10:41:54.762189-0500 Proj[71797:13068977] [AudioHAL_Client] AudioHardware.cpp:1210:AudioObjectRemovePropertyListener: AudioObjectRemovePropertyListener: no object with given ID 0
2018-11-01 10:41:54.762344-0500 Proj[71797:13068977] [AudioHAL_Client] AudioHardware.cpp:1210:AudioObjectRemovePropertyListener: AudioObjectRemovePropertyListener: no object with given ID 0
2018-11-01 10:41:54.762476-0500 Proj[71797:13068977] [AudioHAL_Client] AudioHardware.cpp:1210:AudioObjectRemovePropertyListener: AudioObjectRemovePropertyListener: no object with given ID 0
2018-11-01 10:41:55.091773-0500 Proj[71797:13068837] [] nw_socket_handle_socket_event [C20.1:1] Socket SO_ERROR [61: Connection refused]
2018-11-01 10:41:55.093936-0500 Proj[71797:13068837] [] nw_socket_handle_socket_event [C20.2:1] Socket SO_ERROR [61: Connection refused]
2018-11-01 10:41:55.095026-0500 Proj[71797:13068942] [] nw_connection_get_connected_socket [C20] Client called nw_connection_get_connected_socket on unconnected nw_connection
2018-11-01 10:41:57.099770-0500 Proj[71797:13068847] [] nw_socket_handle_socket_event [C21.1:1] Socket SO_ERROR [61: Connection refused]
2018-11-01 10:41:57.101806-0500 Proj[71797:13068847] [] nw_socket_handle_socket_event [C21.2:1] Socket SO_ERROR [61: Connection refused]
2018-11-01 10:41:57.102978-0500 Proj[71797:13068846] [] nw_connection_get_connected_socket [C21] Client called nw_connection_get_connected_socket on unconnected nw_connection
2018-11-01 10:41:57.178642-0500 Proj[71797:13068977] [AudioHAL_Client] AudioHardware.cpp:1210:AudioObjectRemovePropertyListener: AudioObjectRemovePropertyListener: no object with given ID 0
2018-11-01 10:41:57.179415-0500 Proj[71797:13068977] [AudioHAL_Client] AudioHardware.cpp:1210:AudioObjectRemovePropertyListener: AudioObjectRemovePropertyListener: no object with given ID 0
2018-11-01 10:41:57.182004-0500 Proj[71797:13068977] [AudioHAL_Client] AudioHardware.cpp:1210:AudioObjectRemovePropertyListener: AudioObjectRemovePropertyListener: no object with given ID 0
2018-11-01 10:41:57.212812-0500 Proj[71797:13068977] Task <112D0EE5-B9A2-4B84-A5D0-FA64DB8BBC55>.<3> load failed with error Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLStringKey=[REDACTED], NSErrorFailingURLKey=[REDACTED], _NSURLErrorRelatedURLSessionTaskErrorKey=(
"LocalDataTask <112D0EE5-B9A2-4B84-A5D0-FA64DB8BBC55>.<3>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <112D0EE5-B9A2-4B84-A5D0-FA64DB8BBC55>.<3>, NSLocalizedDescription=cancelled} [-999]
2018-11-01 10:41:57.227445-0500 Proj[71797:13068837] [BoringSSL] nw_protocol_boringssl_get_output_frames(1301) [C13.1:2][0x7fb94e610af0] get output frames failed, state 8196
2018-11-01 10:41:57.227710-0500 Proj[71797:13068837] [BoringSSL] nw_protocol_boringssl_get_output_frames(1301) [C13.1:2][0x7fb94e610af0] get output frames failed, state 8196
2018-11-01 10:41:57.228264-0500 Proj[71797:13068837] TIC Read Status [13:0x0]: 1:57
2018-11-01 10:41:57.228399-0500 Proj[71797:13068837] TIC Read Status [13:0x0]: 1:57
2018-11-01 10:41:57.260645-0500 Proj[71797:13068862] [] nw_socket_handle_socket_event [C23.1:1] Socket SO_ERROR [61: Connection refused]
2018-11-01 10:41:57.262979-0500 Proj[71797:13068862] [] nw_socket_handle_socket_event [C23.2:1] Socket SO_ERROR [61: Connection refused]
2018-11-01 10:41:57.264086-0500 Proj[71797:13068846] [] nw_connection_get_connected_socket [C23] Client called nw_connection_get_connected_socket on unconnected nw_connection
2018-11-01 10:41:59.109282-0500 Proj[71797:13068941] [] nw_socket_handle_socket_event [C24.1:1] Socket SO_ERROR [61: Connection refused]
2018-11-01 10:41:59.112011-0500 Proj[71797:13068941] [] nw_socket_handle_socket_event [C24.2:1] Socket SO_ERROR [61: Connection refused]
2018-11-01 10:41:59.113365-0500 Proj[71797:13068838] [] nw_connection_get_connected_socket [C24] Client called nw_connection_get_connected_socket on unconnected nw_connection
2018-11-01 10:41:59.272784-0500 Proj[71797:13068941] [] nw_socket_handle_socket_event [C25.1:1] Socket SO_ERROR [61: Connection refused]
2018-11-01 10:41:59.275093-0500 Proj[71797:13068941] [] nw_socket_handle_socket_event [C25.2:1] Socket SO_ERROR [61: Connection refused]
2018-11-01 10:41:59.276645-0500 Proj[71797:13068838] [] nw_connection_get_connected_socket [C25] Client called nw_connection_get_connected_socket on unconnected nw_connection
2018-11-01 10:42:01.120251-0500 Proj[71797:13068837] [] nw_socket_handle_socket_event [C26.1:1] Socket SO_ERROR [61: Connection refused]
2018-11-01 10:42:01.122892-0500 Proj[71797:13068837] [] nw_socket_handle_socket_event [C26.2:1] Socket SO_ERROR [61: Connection refused]
2018-11-01 10:42:01.124410-0500 Proj[71797:13068941] [] nw_connection_get_connected_socket [C26] Client called nw_connection_get_connected_socket on unconnected nw_connection
2018-11-01 10:42:01.281477-0500 Proj[71797:13068941] [] nw_socket_handle_socket_event [C27.1:1] Socket SO_ERROR [61: Connection refused]
2018-11-01 10:42:01.283419-0500 Proj[71797:13068941] [] nw_socket_handle_socket_event [C27.2:1] Socket SO_ERROR [61: Connection refused]
2018-11-01 10:42:01.284440-0500 Proj[71797:13068846] [] nw_connection_get_connected_socket [C27] Client called nw_connection_get_connected_socket on unconnected nw_connection
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment