My Easter project, was to build an update to my South Cambridgeshire Bin Collection App. Apple approved it to go onto the App Store this morning. Its now running on the Apple Watch (along with iPhone and iPad) If you live in SCAMBS download for free at -
I’ve submitted for review my Bin Collections WatchKit App. It took a while to get everything correctly code signed, but its done...
So, after fighting it for a while, I’ve realised that most line of business apps need a grid control. iOS just doesn’t have this out of the box, we have UITableView and UICollectionView but they don’t really support the notion of a selectable or editable dataset of records with multiple fields that have dropped down from a database.
So, I’ve been building…
I’ve taken a UIScrollView and built a sub-class (UIGridView). I’ve hand painted a header and a body view on-top of this. I can set headers like this -
gvmaintain.addheader("Work Order", width: 110, sortable: true)
gvmaintain.addheader("Job", width: 60, sortable: true)
gvmaintain.addheader("Crop", width: 110, sortable: true)
I can add rows like this -
I’ve implemented a delegate to pass back when a user has touched on a row
I have gone as far as to implement properties to allow for read-only and multi-selection.
Futures. I’m now looking to add sorting, filtering and the ability to drag and drop change column order.
You have to wonder whether the alliance between Apple and IBM we will see a better out of the box solution in iOS 9?
Its done, my first Apple Watch App. Ready to send to Apple when they allow submissions….
So this is nice. Being able to fully access RPI file system from a Mac. Just tweaked
sudo nano /etc/avahi/services/afpd.service
To get hostname all looking consistent (i.e Mac and PC all see Raspberry Pi having a standard name). So now I can edit and add new files from Mac/PC seamlessly…
So its been a month since I started experimenting with making oData calls from the Apple Watch SDK. I picked up the project again this evening.
I wanted to go beyond the basics and try and get some images out of the Northwind demo database, and display those to my watch user.
I found that Northwind database really does date back to an original Microsoft Access sample and all images in the database are prefixed with 78 bytes of stuff.
So this is what I did to extract the images from the Odata feed (in Swift)
func populate(ret:[NSObject : AnyObject])
if let records=ret["Data"] as? NSArray
var rec:NSDictionary=records.objectAtIndex(0) asNSDictionary
var picstr = rec.objectForKey("Picture") as String
let decodeddata = NSData(base64EncodedString: picstr, options: NSDataBase64DecodingOptions(0))!
var range:NSRange = NSMakeRange(78, decodeddata.length - 78)
var refinedData = decodeddata.subdataWithRange(range)
var ourpic:UIImage = UIImage(data:refinedData)!
End result, images on an Apple Watch!
So I’m syncing data to my App. It all works well, I’m looking at strategies now to disguise the (inevitable) synchronisation process.
At the moment, I have a nice Windows Mobile esq. form. I’m sure I can improve on this...
So I’m drawing to the end of a long day and a long project. As you know I’ve been building an iPad client in Swift that uses Core Data and OData to provide offline and online access to Dynamics NAV.
A few observations -
Odata is different depending on what you do, criteria for a filter clause, is different to an individual clause. You have to remember/guess what to URL escape when to use quotes/double quotes etc.
Don’t fear it. Its powerful. I’ve spent all my time in the front end, not getting bogged down in adding web service methods for everything you need.
Its responsive. If a field isn’t there or something has changed it tells you at runtime. Add web-reference/service reference is just a million miles from this.
Its lightweight. Everything is sent up and down in JSON format. Speed is incredible.
Would I do it again? Now that I have SWIFT libraries and extensions to base classes, HELL YEAH!
Fed up with typing .hidden=true ?
My brain only works with .visible = false
Is it me, or does the World need this SWIFT extension?
Just add this in a file to your SWIFT app.
hidden = !newValue