LCSurface
@protocol LCSurface <NSObject>
An LCSurface
is a UI interaction layer with an LCMicroService
.
-
The canonical name of the surface.
Declaration
Objective-C
@property (readonly, copy, atomic, class) NSString *SURFACE_CANONICAL_NAME;
Swift
static var surface_CANONICAL_NAME: String! { get }
-
A version string of the format
<major>.<minor>.<patch>
for the surface.Declaration
Objective-C
@property (readonly, copy, atomic, class) NSString *SURFACE_VERSION;
Swift
static var surface_VERSION: String! { get }
-
Binds an
LCMicroService
to the surface. This will get called after the micro service is started, but before the service javascript is executed. This gives the surface an opportunity to bind any native functions required by the module.Declaration
Objective-C
- (void)bind:(LCMicroService *)service synchronizer:(LCSynchronizer *)synchronizer;
Swift
func bind(_ service: LCMicroService!, synchronizer: LCSynchronizer!)
Parameters
service
The micro service to bind.
synchronizer
Used for synchronizing asynchronous init.
-
Attaches an
LCMicroService
to the UI.Declaration
Objective-C
- (UIView<LCSurface> *)attach:(LCMicroService *)service onAttached:(LCOnAttachedHandler)onAttachedHandler;
Swift
func attach(_ service: LCMicroService!, onAttached onAttachedHandler: LCOnAttachedHandler!) -> (UIView & LCSurface)!
Parameters
service
The
LCMicroService
to attach.onAttachedHandler
An execution block to be called after the UI is active
Return Value
The UIView of the newly attached surface.
-
Detaches any currently attached
LCMicroService
. TheLCSurface
may then be ready to be discarded or reattached to anotherLCMicroService
.Declaration
Objective-C
- (void)detach;
Swift
func detach()
-
Detaches and clears the LCSurface. This is the preferred method when the
LCSurface
is to be reused.-detach
may leave behind some UI state, as it expects that the micro service may later be re-attached.-reset
clears any UI state back to a fresh state.Declaration
Objective-C
- (void)reset;
Swift
func reset()