XojoiOSWrapper

XojoiOSWrapper is a module that adds to Xojo iOS a collection of methods that wrap the new framework into legacy methods so existing code written in classic framework can run mostly as is.

I just added two methods I just needed for one of my apps :

  • Str does the same thing as classic Str(color), which turns a color in its string expression, or Str(number) which turns a number into its Text value, or Str(Date) which returns SQLDateTime.

  • Transparent iOSImage.Transparent as iOSImage which turns the white in a picture to transparent, like classic Transparent does. The function is slow because it relies on pixel, but it does the job. With some luck in the future, Interops will enable replacing pure Xojo code by a much faster call to the framework.

Enjoy !

Thanks for sharing. Very useful indeed.

As I am porting Check Writer to iOS, I have to add things to the wrapper as I go along for existing code to execute without extra refactoring. Today, I just added Boolean to Str, so you can do this like in Desktop

Dim T as Text Dim B as Boolean = True T = Str(B) Break // T = "True"

I didn’t know you could do it with Str(), although it makes perfect sense boolean being a numeric value.

I’ve used an archaic extends function for the longest time .stringValue… lol…

Booleans aren’t numeric though :slight_smile:
booleans are logical values not numbers

Now when you get right down to it at a byte level everything is “numeric” but …

I use custom classes and iOSContainerControls, and sometimes have to access the current view. For instance to call the picture picker. So I added

  • TrueWindow
  • TrueView

As in

ContainerControl.TrueView as iOSView

Both do the same thing, return the view onto which the control rests. It works within iOSContainerControls, as well as custom iOSControls.

Just added isNumeric().

Adding graphics :

  • g.Forecolor
  • g.TextAscent()
  • g.StringWidth()
  • g.StringHeight()

I wanted to add g.Bold and g.Italic, but it appears these are purely and simply absent from iOSGraphics.