Skip to content

Commit dfe1943

Browse files
committed
feat: compile framework.
1 parent 0522a0a commit dfe1943

File tree

6 files changed

+35
-36
lines changed

6 files changed

+35
-36
lines changed

dart_native/example/ios/Podfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ EXTERNAL SOURCES:
2323

2424
SPEC CHECKSUMS:
2525
CocoaLumberjack: e8955b9d337ac307103b0a34fd141c32f27e53c5
26-
dart_native: ba4adc85a5cf6faafbfa7de2252397388d9480da
26+
dart_native: e10848b23206739fc16a2455f41847418a8ceb3d
2727
Flutter: 0e3d915762c693b495b44d77113d4970485de6ec
2828

2929
PODFILE CHECKSUM: f10e42e188a012076f9d5e111f499229a501832a

dart_native/example/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,10 +248,12 @@
248248
inputPaths = (
249249
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
250250
"${PODS_ROOT}/../Flutter/Flutter.framework",
251+
"${PODS_ROOT}/../.symlinks/plugins/dart_native/ios/DartNative.framework",
251252
);
252253
name = "[CP] Embed Pods Frameworks";
253254
outputPaths = (
254255
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework",
256+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/DartNative.framework",
255257
);
256258
runOnlyForDeploymentPostprocessing = 0;
257259
shellPath = /bin/sh;

dart_native/example/lib/ios/ios_main.dart

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import 'package:dart_native_example/ios/delegatestub.dart';
22
import 'package:dart_native_example/ios/runtimeson.dart';
3-
import 'package:dart_native_example/ios/runtimestub.dart';
43
import 'package:dart_native_example/ios/unit_test.dart';
54
import 'package:flutter/material.dart';
65
import 'dart:async';
@@ -24,23 +23,21 @@ class _IOSAppState extends State<IOSApp> {
2423
Future<void> initPlatformState() async {
2524
RuntimeSon stub = RuntimeSon();
2625
DelegateStub delegate = DelegateStub();
27-
// testIOS(stub, delegate);
26+
testIOS(stub, delegate);
2827
// Benchmark
2928
String testString =
3029
'This is a long string: sdlfdksjflksndhiofuu2893873(*(%¥#@)*&……¥撒肥料开发时傅雷家书那份会计师东方丽景三等奖';
3130
int time = DateTime.now().millisecondsSinceEpoch;
3231

33-
// for (var i = 0; i < 10000; i++) {
34-
// String _ = await platform.invokeMethod('fooNSString:', testString);
35-
// }
32+
for (var i = 0; i < 10000; i++) {
33+
String _ = await platform.invokeMethod('fooNSString:', testString);
34+
}
3635

3736
print(
3837
"Flutter Channel Cost: ${DateTime.now().millisecondsSinceEpoch - time}");
3938
time = DateTime.now().millisecondsSinceEpoch;
40-
var count = 0;
41-
for (count = 0; count < 10000; count++) {
42-
// String _ = stub.fooNSString(testString);
43-
String a = await stub.fooNSStringAsync(testString);
39+
for (var i = 0; i < 10000; i++) {
40+
String _ = stub.fooNSString(testString);
4441
}
4542

4643
print("DartNative Cost: ${DateTime.now().millisecondsSinceEpoch - time}");

dart_native/example/lib/ios/unit_test.dart

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -106,24 +106,24 @@ testIOS(RuntimeStub stub, DelegateStub delegate) {
106106
set = stub.fooNSMutableSet(Set.from([1, 2.345, 'I\'m String', rect]));
107107
print('fooNSMutableSet to Set: $set');
108108

109-
// stub.fooBlock((NSObject a) {
110-
// print('hello block! ${a.description}');
111-
// return a;
112-
// });
109+
stub.fooBlock((NSObject a) {
110+
print('hello block! ${a.description}');
111+
return a;
112+
});
113113

114-
// stub.fooStretBlock((CGAffineTransform a) {
115-
// print('hello block stret! ${a.toString()}');
116-
// return CGAffineTransform(12, 0, 12, 0, 12, 0);
117-
// });
114+
stub.fooStretBlock((CGAffineTransform a) {
115+
print('hello block stret! ${a.toString()}');
116+
return CGAffineTransform(12, 0, 12, 0, 12, 0);
117+
});
118118

119-
// stub.fooCStringBlock((CString a) {
120-
// print('hello block cstring! $a');
121-
// return CString('test return cstring');
122-
// });
119+
stub.fooCStringBlock((CString a) {
120+
print('hello block cstring! $a');
121+
return CString('test return cstring');
122+
});
123123

124-
// stub.fooCompletion(() {
125-
// print('hello completion block!');
126-
// });
124+
stub.fooCompletion(() {
125+
print('hello completion block!');
126+
});
127127

128128
stub.fooDelegate(delegate);
129129

@@ -143,13 +143,13 @@ testIOS(RuntimeStub stub, DelegateStub delegate) {
143143
stub.fooWithOptions(TestOptions(TestOptionsOne | TestOptionsTwo));
144144
print('fooWithOptions result:$options');
145145

146-
// Class('NSThread')
147-
// .performAsync(SEL('currentThread'), onQueue: DispatchQueue.global())
148-
// .then((currentThread) {
149-
// NSObject description = currentThread.perform(SEL('description'));
150-
// String threadResult = NSString.fromPointer(description.pointer).raw;
151-
// print('currentThread: $threadResult');
152-
// });
146+
Class('NSThread')
147+
.performAsync(SEL('currentThread'), onQueue: DispatchQueue.global())
148+
.then((currentThread) {
149+
NSObject description = currentThread.perform(SEL('description'));
150+
String threadResult = NSString.fromPointer(description.pointer).raw;
151+
print('currentThread: $threadResult');
152+
});
153153

154154
NSNotificationCenter.defaultCenter.addObserver(
155155
delegate, delegate.handleNotification, 'SampleDartNotification', nil);
296 Bytes
Binary file not shown.

dart_native/ios/dart_native.podspec

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ Write native code using Dart. This package liberates you from native code and lo
1515
s.source = { :path => '.' }
1616

1717
# Debug
18-
s.source_files = 'Classes/**/*', 'libffi/*.h', 'common/**/*'
19-
s.vendored_libraries = 'libffi/libffi.a'
18+
# s.source_files = 'Classes/**/*', 'libffi/*.h', 'common/**/*'
19+
# s.vendored_libraries = 'libffi/libffi.a'
2020

2121
# Release
22-
# s.source_files = 'Classes/DartNativePlugin.*'
23-
# s.vendored_frameworks = 'DartNative.framework'
22+
s.source_files = 'Classes/DartNativePlugin.*'
23+
s.vendored_frameworks = 'DartNative.framework'
2424

2525
s.public_header_files = 'Classes/DartNativePlugin.h'
2626
s.dependency 'Flutter'

0 commit comments

Comments
 (0)