iOS Tutorial Static Modules and Classes

There are two types of modules in B4i: static modules and classes.

A class is a template. At runtime you can create any number of instances based on the class template.
Each instance will have its own set of global variables (its state).

You must call the class Initialize method before you call any other methods of the class. Note that you can change the Initialize sub signature as needed.

Static modules can be considered singleton classes or a template with exactly one instance (with the same name).

Unlike B4A (and like B4J) static modules can handle events.

If you are converting a B4A project to B4i then B4A activities and services should be converted to static modules.
Note that you don't need to use CallSub or CallSubDelayed to interact with subs in other modules. You can call them directly.

The program structure is more flexible than in B4A as you don't need to create a new module for each Page. However that means that you need to pay more attention to your program architecture.
 

fishwolf

Well-Known Member
Licensed User
Longtime User
if i want use a module for write the code for a specific section of project, can i do ?

i have try to only create a new module and the app start with a blank page.

for a big project is better divide the code in modules.
 

fishwolf

Well-Known Member
Licensed User
Longtime User
if i want use a module for write the code for a specific section of project, can i do ?

i have try to only create a new module and the app start with a blank page.

for a big project is better divide the code in modules.

Why if i add a new module (empty) the app stops working ?
the same also if i add a exist module as httputil2.
show a empty page
 
Top