[View]  [Edit]  [Lock]  [References]  [Attachments]  [History]  [Home]  [Changes]  [Search]  [Help] 

test[S8ObjC] 030 instantiation

SwikiCodeRobot @> 399

"Import Foundation"
S8ObjC import: #Foundation

Accessing classes

"lookup of some classes"
| classNames results |
classNames := #( NSObject NSString Hello World JX8IosTest JX8Controller ).
results := #( true true false false true true ).
100 timesRepeat: [:i|
	(classNames collect: [:each| (ObjCClass named: each) notNil ] ) = results ifFalse: [
		self error: 'Wrong result'
	].
Smalltalk gc.
]. #done.


JX8IosTest allocation

"alloc+init JX8IosTest"
| cls object |
cls := ObjCClass named: #JX8IosTest.
1000 timesRepeat: [:i|
	object := cls newInstanceHandle.
].
Smalltalk gc.
self print: #done.