Slide 9
Slide 9 text
9
Tips: Swiftクラスのエクスポート
1. ΤΫεϙʔτ͍ͨ͠ΫϥεΛJSExportʹ४ڌ
2. ϑΝΫτϦؔΛ༻ҙ
Copyright(C)
2
0
2
3
ALL RIGHTS RESERVED, MedPeer, Inc.
@objc
protocol ColorJS: NSObjectProtocol, JSExport {
var r: CGFloat { get }
var g: CGFloat { get }
var b: CGFloat { get }
var a: CGFloat { get }
}
final class ColorImp: NSObject, ColorJS { ... }
@objc
protocol ModuleJS: NSObjectProtocol, JSExport {
static func Color(_ r: CGFloat, _ g: CGFloat, _ b: CGFloat, _ a: CGFloat) -> ColorJS
}
const color = module.Color(0.5, 0.6, 0.7);
const red = color.r;
.swift
.js