Skip to content

Commit 8b6befb

Browse files
committed
Added base makefile
1 parent 9ad9421 commit 8b6befb

File tree

3 files changed

+29
-12
lines changed

3 files changed

+29
-12
lines changed

Makefile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
.PHONEY: test
2+
3+
RUNTIME_ID=$(shell xcrun simctl list runtimes | grep iOS | cut -d ' ' -f 7 | tail -1)
4+
5+
6+
DEVICE_ID=$(shell xcrun simctl list devices 'iOS 13.5' | grep -v '^--' | grep -v '==' | head -n 1 | cut -d ' ' -f 6 | sed 's/[()]//g')
7+
8+
boot-sim:
9+
xcrun simctl boot $(DEVICE_ID) || true
10+
11+
tests: boot-sim
12+
cargo dinghy --platform auto-ios-x86_64 test
13+
14+
bundle:
15+
cargo bundle --example rect --format ios --target x86_64-apple-ios
16+
17+
bundle-install: bundle
18+
xcrun simctl install booted target/x86_64-apple-ios/debug/examples/bundle/ios/rect.app
19+
20+
bundle-run: bundle-install
21+
RUST_LOG=debug xcrun simctl launch booted com.github.simlay.uikit-sys.rect

examples/rect.rs

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ pub fn main() -> ! {
4141

4242
let root_vc: id = unsafe { *(window.ui_view_controller() as *mut id) };
4343

44-
let root_view: UIView = UIView::from_id(window.ui_view() as id, true);
44+
let root_view: UIView = UIView(window.ui_view() as id);
4545
unsafe {
4646

4747
//let background = UIColor::alloc().initWithRed_green_blue_alpha_(0.1, 1.0, 2.0, 2.0);
@@ -68,7 +68,7 @@ pub fn main() -> ! {
6868

6969
match event {
7070
Event::NewEvents(StartCause::Init) => {
71-
let root_view: UIView = UIView::from_id(window.ui_view() as id, true);
71+
let root_view: UIView = UIView(window.ui_view() as id);
7272
//add_views(&root_view);
7373
unsafe {
7474
root_view.addSubview_(label.clone());
@@ -103,7 +103,6 @@ pub fn main() -> ! {
103103
_ => {
104104
},
105105
}
106-
println!("LABEL REF COUNTE: {:?}", label.get_retain_count());
107106
})
108107
}
109108

@@ -194,7 +193,7 @@ fn add_counte_label(count: i64) -> UIView {
194193
let label = unsafe {
195194
//let alloc = UILabel::alloc();
196195
//printlnalloc.print_retain_count();
197-
let label = UILabel::from_id(UILabel::alloc().init(), true);
196+
let label = UILabel(UILabel::alloc().init());
198197

199198
label.setFrame_(CGRect {
200199
origin: CGPoint {
@@ -207,24 +206,20 @@ fn add_counte_label(count: i64) -> UIView {
207206
},
208207
});
209208

210-
/*
211209
let text_alloc = NSString::alloc();
212-
let text = NSString::from_id(
210+
let text = NSString(
213211
text_alloc.initWithBytes_length_encoding_(
214212
text_ptr as *mut std::ffi::c_void,
215213
text_length,
216214
NSUTF8StringEncoding,
217-
),
218-
true
215+
)
219216
);
220217
label.setText_(text);
221-
*/
222218
label
223219

224220
};
225221
//label
226-
//UIView::from_id(label.id())
227-
label.into()
222+
UIView(label.0)
228223
}
229224
fn debug_init() {
230225
color_backtrace::install_with_settings(

ios-example/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ run: install
66
install: xcodebuild
77
xcrun simctl install booted build/Build/Products/Debug-iphonesimulator/use_uikit_example.app
88

9+
DEVICE_ID=$(shell xcrun simctl list devices 'iOS' | grep -v '^--' | grep -v '==' | head -n 1 | cut -d ' ' -f 7 | sed 's/[()]//g')
910
xcodebuild: generate
10-
xcodebuild -scheme use_uikit_example -configuration Debug -destination 'platform=iOS Simulator,name=iPhone SE (2nd generation),OS=13.6' -derivedDataPath build
11+
xcodebuild -scheme use_uikit_example -configuration Debug -derivedDataPath build -destination "id=$(DEVICE_ID)"
1112

1213
generate: project.yml ios-src/Info.plist ios-src/main.m ios-src/bindings.h
1314
xcodegen

0 commit comments

Comments
 (0)