After doing about five hours of training video for iOS for Xojo I’ve discovered a few things. First, the new framework will take some getting used to. It’s not that it’s difficult to figure out, it’s just different. Each little difference requires that I analyze what it’s doing and evaluate if I need to change my coding practices.
We’ve already talked about one of those differences with the FromText methods. In the old framework using string.val does a lot of assumptions (not all of them good ones as we’ve come to find out) and those assumptions will either result in a valid number or a zero. Blank strings also convert to a zero as well.
We’ve all been used to those assumptions for so long that we didn’t even realize the assumptions. Or we ignored them. Either way, we depended upon them. The new framework uses much more stringent rules and if the text is outside of those rules it will throw an exception.
We can argue all day long whether it’s really an exception but that’s an argument for a different day. Xojo has decided that errors shall not be silent (am I the only one that just said in a Gandolf voice, “Thou shall not pass (errors)!”?). Errors causing excpetions will change the way we code and I’m still not entirely sure that I’m comfortable with those changes yet. I’m sure it’s really a matter of getting used to them.
The other thing I’ve discovered is that events on iOS controls are different than their desktop and web counterparts. In desktop and web if you set the value of a control it fires their relevant change events. In iOS it does not.
In desktop and web apps we’ve actually relied upon this behavior. Rightly or wrongly, it was there so we did. This also meant, however, that we’ve had to somehow make a distinction of whether or not the user or the developer set the value (and caused the event). Usually it was a matter of setting the control enabled = false while loading the data and then setting enabled = true when we were done.
Since iOS does not have this behavior I suspect we’ll start putting less code in the events of controls and instead use a method that does the work. This is probably a good thing. Being dependent upon the events to do something will make us better programmers in the long run (hopefully). It’s not really a huge change but it’s a somewhat important one given the background Xojo developers have in desktop and web.
At first I thought this might be a bug but after cornering a Xojo engineer this was by design. I can live this change now that I’m aware of it. Do you have different thoughts on this?
What significant changes have you found in iOS that were a surprise?