Dave Nott is planning his new app, and it’s time to think about functionality, data models, and set up. We discuss some of the technical challenges ahead, and some of the questions that a developer should consider when starting a green field iOS project.
Dave Nott is planning his new app, and it’s time to think about functionality, data models, and set up. We discuss some of the technical challenges ahead, and some of the questions that a developer should consider when starting a green field iOS project.
It feels like it’s gonna take quite a while, but that’s okay. I think this time around I’m kind of more realistic about how long it’s likely to take, and I’m less likely to give myself a hard time over it as well. I’m more aware now of how little time I’ve got, before I had quite lot of time with ArmChair whereas now I’m acutely aware I have hardly any time. So I’m kind of giving myself an easier time, whereas before I would beat myself up like crazy if I wasted a morning on anything there wasn’t that if you know what I mean
I just decided if it’s going to get into my head and make me unhappy that it’s just not worth doing, so if I’m going to do it if I’m gonna do it I’m gonna do on my terms, that’s the end of it. And all of a sudden I feel better about it
It’s funny actually as well I think I felt at times when I’ve done that sort of thought process and ended up kind of feeling happier about stuff, sometimes I’ve then ended up piling a load of time into the project anyway but knowing that I can kind of just sort of go ‘right that that’s that’s as much as that’s got’ and sort of walk away from it it’s been easier for me to do that
Yeah I mean the way I’ve kind of got it in my head is a I’m gonna just try and treat it almost almost like a hobby because by definition hobbies you should enjoy your hobbies. Rather than treating it as this thing that I must do and like I say give myself a hard time if I don’t get any time today tomorrow the next day to do it.
I just just need to kind of keep everything in check really because otherwise I end up taking the project away with me in my head and then I just get into like bad moods and stuff, and I’m not fully able to enjoy the other stuff that I’m doing that isn’t that.
I mean just like silly things where I’ve been working on something while Charlie’s taking a nap or something, he wakes up and Heather says why don’t we take a walk up to the park with Charlie, and I’m there sort of pushing Charlie on the swing thinking about what I’ve been doing and getting frustrated that I’m unable to do any more to it for the time being and stuff like that. Which sounds ridiculous doesn’t it –
– Yeah it sounds ridiculous when you sort of vocalize it and play it out, but it doesn’t feel ridiculous at the time. I don’t know I can totally relate, you know like that’s that’s me all over when I’ve sort of a head full of work or whatever. I think that’s probably the difference really, is that if you can kind of compartmentalize it so that it’s not work you know, and then it’s a hobby, it’s something that you’re doing for the enjoyment of it then that’s probably going to keep it in the right place
Yeah I hope so, I don’t want it to get like that again, so if it’s gonna happen it’s gonna happen the right way, as opposed to me just feeling rubbish all the time about it. See how I feel in a few weeks!
So some of you keen listeners of the show may know I’m sort of working on a new task management / notes app. The idea behind it is if a user wants to take down some notes to go alongside a task, I want that user to be able to take down notes that contain text. Kind of rich text so headings, bold text, underline text. maybe color text, also within that it’d be cool if the user could insert images inline.
Maybe you’d have a paragraph of text, and an image, and another paragraph or text, also perhaps pencil drawings that are inline, so rather than having an image you might have a pencil drawing instead. Also perhaps there could be some kind of little mini checklist inside of the the note as well, so kind of like bullet points that you can sort of tap on it and turn from a bullet point to a tick.
So my situation right now and I’ve only looked into this a teeny tiny amount so far so excuse any severe lack of knowledge. I’ve looked in to things like textkit a little bit and attributed strings but like I say not in any great depth right now. So I’m at the point where I’m kind of looking at this kind of in the abstract and I haven’t gone deep in any particular direction, so I figured this could be a cool chance bounce off you Dave and see if you’ve got any thoughts, and also if anyone listening is got any thoughts.
I’m all ears at that moment as to how it might be structured, because in my head there’s kind of two ways of going about it you could almost have it as like one sort of giant attributed string maybe in some way, though I’m not sure how not sure where the limits are on attributed strings and how practical that would be. Or whether I store things as individual elements and then loop through and spit them out onto the page, so it could be you store a block of text and you store an image separately and you store another block of text and you store another image and it sort of loops through and when it goes to display on the screen, it goes text image text image if I’m making sense. Yeah in a bit of a pondering state right now as to where I should be going
Okay, so taking up the baton with this a little bit I think you should be looking into attributed strings and specifically within that NSTextAttachment.
I believe one of the things you can do is that you can add in objects essentially into the attributed string, so things like images can be turned into attachments and then inserted into the attributed string. So that gets you part of the way there.
Now I think the other place that you were were kind of mentioning before is if you’re sort of thinking about having distinct kind of content categories that are then almost in an array, that you said before is text, an image, a drawing or whatever, you know you’ve kind of got all these different types of content and I guess they’re all they’re also happening kind of inline you know one after the other.
I would actually start to think of this more like you’re gonna store things in terms of your data model. Okay so, if you imagine your note document, your note document is going to have these distinct elements the can exist inside of it, you’ve got a text element, you’ve got your drawings, you’ve got your inserted images. There could even be the potential to put things like video or other media in there as well.
This is where things like protocol orientated programming sort of within Swift can kind of come into its own own sort of place as well, because I’d be thinking about defining a kind of data model that has a protocol that describes an elements that is part of that note document. So a note document becomes an array of my specific elements that are defined by this protocol, and then within that you can then have different types of element that are fulfilled by different implementations of that protocol. So for example a text element is just just one type, it’s an object that adheres to that element protocol however you want to define it. Additionally to that, having a drawing element, or video element, or something like that, they are just other implementations of the same protocol. So you’d be looking for commonalities about what might define something as an element within a note.
One one way you might then sort of take this – again I’m kind of like trying to sort of sketch this out mentally in my head as we go along- but you might you might want to think, well okay that protocol could have things like… maybe you ask that element what it’s attributed string representation is. Maybe there’s a function that objects that adhere to that protocol have to implement, and that is a render to attributed text function or something like that. So in that case each one of these different types of of elements are then responsible for for how they kick you kick out a piece of attributed stringm, and if you’ve got that sort of set up then rendering it out into a complete attributed string is a case of sort of iterating over the array of elements inside of the notes and asking each one of them ‘okay give me your rendering to an attributed string’ and then just concatenate in all those things together
Because if you’ve got these things all together then the beauty of it is is you can sort of keep extending out this definition of what an element is, and making it kind of bend to your will and sort of doing what you want it to do. Because you may decide you know maybe there’s another way of representing these things for example, or it might be there might be a process where you want to be able to filter off all of the the images inside of a note, and maybe just out output those to something or have them displayed in some other fashion
It’s interesting you say that because I kind of did that typical developer thing where I started designing it so that it would result in an easier implementation. I kind of had it in my head like, “yes this is gonna work loads better” and “isn’t it convenient that it’s also easier”. Actually once I’d finished it and looked at it, I was like no that sucks. That’s just me trying to make something easy for myself so I kind of made it that anything like an image or a pencil sketch or anything would be would be considered like an attachment to the note, and that would therefore be accessible via a horizontally scrolling collection view that sits at the bottom of the screen. Then that way, I don’t have to worry about inlining them as they’re just completely separate and then the note is just a plain text note and then all the stuffs attached down the bottom and I can just call upon them when I want. But actually, in reality, once I’d sort of taken a step back and looked at it, it really wasn’t the right approach because I think they need to be in line because the note that surrounds them is going to add a lot of context to that image, or that pencil drawing. Yeah, it’s absolutely crucial that they’re in line so I think what the approach you’re describing there with the whole attributed string and then concatenate them together so they all sort of flow out onto the screen in in order…I think that’s that’s definitely going to be an approach I should look at in more detail. Yeah…breaking everything down into its smaller parts and then joining it back together rather than it all just being one giant thing in the first place.
Yeah and it’s not…not hitching yourself to a particular wagon in a lot of ways as well because like on the next version of of Swift, or within the next version of iOS, we could have some brand new text management or string implementation that you might want to leverage, right? This is absolutely possible ’cause I mean this is what it’s called NS text attachment you’re looking at…something quite old and that’s great because it can do all these things as it’s been around for so long, but yeah it could be that there’s some other thing that you want to use and if you’ve done it this way where your elements are their own thing and get them to kick out a new representation which becomes a new function within that the protocol that defines them and a new implementation on the objects themselves, so yeah that way then you know you’re not kind of limiting yourself, you’re not trying to store this this attributed string as a thing in its own right, you’re trying to store the things that constitute the the output that’s going into that string and down the line that can pay off in other ways, I mean this this could be…you don’t know where you’re going to go with this app, but there could be a position where you want to upload all of this stuff to WordPress, just there’s an example, you might want to take the whole method of writing out this this beautiful note and having a button that pushes it up to WordPress and and makes a post out of it…just this as an example and again by having your elements, you could have some other sort of extension on top of those it says okay I want you to spit out markdown or HTML you know and it generates that and based on the info that’s in the elements themselves. So yeah, doing that sort of I guess extra legwork up front in defining your data model, it then pays these dividends down the track.
Yeah I think breaking it into its smallest parts now allows you to re-glue it in different ways down the road. That makes a lot of sense. Yeah I think now is the wrong time for me to be diving in on a development level on this stuff. I just kind of want to get a view in my head as to what the direction I should be going, but like you were saying, we’re dealing with sort of NS stuff here which indicates it’s pretty old. For all we know, I mean when’s dub-dub now? a month away? A little over a month? Yeah there could be something completely new that comes out at dub-dub that sort of changes changes everything. So I think I’m unlikely to really dive in at a code level much before WWDC on this. I think now is a bad time for development, wel, this sort of greenfield development for me right now with dub-dub being so near. Just in case some new API or some new something they announce could invalidate weeks of work. Right now, my best use of my time is kind of thinking at more of an abstract level in terms of design, in terms of visual design and kind of architecture design and things like that. So yeah, that’s where we are. I feel like I’ve got more of an interest this year in WWDC in terms of things they might announce because I’ve got all these things that I know it lay ahead of me and technical challenges that lay ahead of me and I’m kind of looking at WWDC and thinking I wonder if maybe just one of them could be made to go away or made loads easier with some brand new framework. Yeah, I’m kind of excited for it more this year than I have been in previous I think.
I was just gonna say, I think it you’re absolutely right. You need to be sort of defining the the design of the app and again, that sort of feel and the flow through the app and doing all of that work. You know it’s not quite dead time between now and WWDC, but certainly if you’re starting a new app, this is work that needs to be done anyway, regardless of what happens in June. So you know, this is time well spent right now, getting everything designed out, kind of going through stuff like wireframes and sketching out the flow through the screens of the app itself, and then I guess you’re are starting to get into those questions and sort of follow-on from having that that kind of view of the app in terms of its functionality that if you ask sort of questions of each each screen and kind of flesh out each wireframe in terms of what the app needs to do then that information can sort of start building this view of that sort of stuff things like elements and data models and…
Yeah exactly, so it sounds like you’re at a stage with this project where you can sort of start doing some of the kind of introspective questions that you would do with a new piece of work, sort of defining…okay, what’s it going to be? What does it look like? And you know, how is it going to work overall? Some of that is as we were talking about a minute ago, it’s things like design and sort of general flow of the app and then stuff like of architecture and things like data models…all of that. I would sort of also be starting a new piece of work off by kind of asking a few kind of key questions. So I’ve got a few that I sort of work through with new projects these days and specifically for for iOS development it’s I think some of these things are quite important so I’m going to hit a few of these off of you Dave and see where you’re at. No pressure or anything, it’s a bit of fun…we’ll see! Okay… so things like will you be considering localization?
That’s interesting, because most of the content of the app will be written by the user. You can look at that two ways…you could be like, well in that case I don’t need to bother with localization or you could look at it (which is the way I am looking at it) that given that there is going to be so little localization work to do, I think as it stands now, then definitely, I’ll do it. I don’t think I’ve got a reason not to do it, because aside from maybe an about screen or help screen or settings, everything else is going to be input by the user. Therefore it will be in the language they use in any case. The only thing I’ve been thinking about, and I was thinking given that this is like a task management / notes app, that gives me quite a nice framework to lay out a tutorial section. So, when you first launch the app, maybe I could have a couple of notes already in there pre-populated the can take the user through the features of the app. So if I was going to go down that route, that would expand the scope of localization a little bit, because they’re probably going to be more involved than just like a couple of buttons on a help screen. I’ve never done localization before, so I’ve not looked at it from a code point of view, but actually in practice doing it, I’d imagine it’s pretty hard finding people that know all of these languages well enough that are willing to help me convert my text.
I think from a code point of view, it can be quite easy, provided you sort of go that way from the start. You know, like everything I sort of do these days. all of the text strings are wrapped up in a localized strings file anyway. And when they’re introduced into the app, I’ve got a couple of helper functions sort simplify the call, but you know by and large, I’m using a localized string and displaying that, so yeah I mean even if the app remains English forevermore, it makes sort of replacing copy changes and stuff like that really easy. But yeah, it’s the sort of thing that planning with it being that way, and then kind of see how you go. I guess getting the strings files themselves converted to other languages once you’ve got them that’s the sort of thing you can outsource and send off to different fulfillment agencies if you really had to. It’s also the sort of thing that you could perhaps launch the app and sort of see where things are after you’ve launched the app and you know, if a couple of hundred people have downloaded it or whatever and you can check that back on iTunes Connect and sort of see whereabouts in the world they are. Then you know you might want to pick like the next one down in terms of volume but it’s kind of related I think as well sort of thinking about this sort of stuff, it can get quite interesting in terms of things like dynamic text which is kind of to the side of this, the way they’re related is that localizing and dynamic text do things that can potentially impact the layout that you’ve got in your app, so you can have an absolutely beautiful design, everything is sort of pixel perfect and then you change things to support another language or support dynamic text and then because of that , that design just completely fails, you know, some text overflows or whatever. So I think answering the questions as to whether you’re going to support that and also kind of thinking about stuff like “am I going to support dynamic text?”… I would strongly suggest that the answer to that is yes, I think these days just kind of from an accessibility point of view and the fact that there is an aging section of the market as well, as time goes on I think we’re all going to appreciate being able to sort of make the text on our screens where we want to, but by answering those questions, you’re kind of thinking of it from that point of view from fthe get-go… Kind of having a plan for for what your design is going to do when things overflow or whatever, then you know that’s the sort of thing that if you can do that now it’s probably a good time.
Yeah and I think maybe this app kind of lends itself to that more than others would, so for the most part it’s sort of displaying different lists of tasks or sort of outer lists of tasks so you have a section called podcast topics and then you tap into podcast topics and then there’s all the different topics that we’ve discussed and if you tap one of those, you can see more notes about that individual task, so it’s kind of like layers of table views right now which is probably a pretty good place to start when thinking about supporting dynamic text anyway, then obviously when you get into the note it’s kind of a note document so yeah I think the potential for things to go terribly wrong isn’t that high I would say definitely yes to that question I think I’m in a better place than maybe I would be if the app was something different, it’s just essentially some table views right now and then you sort of go through to a detail view where the note is displayed so I don’t think I’ve got any reason not to really I can’t think it can’t have a good reason to say no…
Like I think it’s more a case of kind of taking a look at your design sort of when you kind of feel it’s complete, and then playing it back to yourself and sort of going…well okay, how would this look if…? Maybe dummying a couple of screens up and then just just turning things on and turning the the text sizes all the way, sort of seeing how things are handled. Just kind of get a feel for that sort of thing before you’re too far down the development path because it can be one of those sort of things that to get it in at the end of a project is kind of twice the work and not awesome.
Well this is one of the cool things isn’t it, like starting over is where these kind of questions can be answered right at the start and you can generally sort of take the right approach to it, in that yes I am going to support it as opposed to looking at an old legacy app that doesn’t support it and then it’s like “oh no I’ve got to change everything to make this work” but right now, this is like totally greenfield so unless you’ve got a really good reason not to I don’t see why you wouldn’t. So yeah I think I think I’m in a very fortunate position and due to the nature of my app and the fact that it’s brand-new, I mean haven’t even coded anything yet so that’s how brand new it is.
Things like asking for permission to access things like the camera roll to access you know the cameras themselves, photos location data, or anything like that. If you’re looking at the design of your app it can be quite nice to think about how you’re going to ask for those things, and when you ask for those things, because it can be quite nice to roll that into the flow of the onboarding with the app. I guess I come at it from an angle of trying to avoid alerts that just come over the top of something, and they’re not really related to what the user is seeing. So yeah, at the start of a new project, think about those things, where they might fit into your app and the flow
Yeah well I look at other app, that I’ve downloaded recently and when you first start them up, you kind of end up with like four or five of these that just pop up one after another. You know can we use your microphone? Yes. Can we use your camera? Yes . Can we need use this…? Yes yes yes yes. But then I don’t know that I’m comfortable with that a lot of the time because I haven’t even got into the app yet. I basically just got past the splash screen and now I’m confronted with all these boxes saying we want to use all of this stuff can we? It’s like I don’t know yet, I don’t know if I like the app, I haven’t even seen it!
Apps I find I find out I’m more comfortable with it, are when I’m asked kind of when it’s appropriate to be asked. So let’s say say you’re in like the Instagram app, or Facebook app, or Twitter, or something and for the first time you go to take a photo in the app to upload. That’s probably the point where you should see the first request “can we use your camera?” that kind of thing rather than right at the start. It’s like well yeah you can but why do you want this? I don’t know why you want it you’re just asking me for what seems like no good reason, whereas if you go to do something in the app to trigger some functionality that needs it, and then it goes “oh to do this we need access to this, is this okay?” as the user I think you’re then in more of a position to make a judgment call on it, because otherwise it’s “why it want access to my microphones? You’re just gonna start recording me whenever it fancies” or whereas if say you’ve got a voice memo app, you go to take your first voice memo, “oh by the way we need your mic. Is that okay?”, yes it is okay because I actually want to take a voice memo right now. It just adds in a bit of context around it. And also I think it makes for quite a sucky onboarding process to be like one pop up after another, after another, after another and this is like you can always get the impression that this app is just designed to suck up data in a way if it’s asking for all these permissions
So I think that also leads me to to another thing which is kind of related, and that is thinking about stuff like negative state. So you know if you’ve got things that the app does that rely on having some of these permissions, or relying on the user to have taken some sort of action. Yeah, what does that look like? How are you gonna tell the user about that? I guess I’m not expecting you to have answers to this as a question but I’m sort of just pointing out that like you know, again that’s the sort of thing, that now you can kind of be thinking about those kind of positions in the app as well.
Because it’s easy to sort of look at what you want the app to do and to kind of imagine the perfect state you know, the screen kind of looking as functional as it can possibly look, and everything’s turned on and all of the rest of it. And then actually then when you sort of start thinking about well okay if they’ve not got if they’ve not given access to the camera roll, then we can’t show this bit, or you know if there’s no access to the camera then we can’t do this here. So I guess now it’s probably a good time to sort of put that lens onto things, the design and sort of think about those
Yes, in my head I’ve never actually had to ask for any of these things before in an app, so I’m not sure what the kind of the flow of it’s like from a coding point of view, but in my head I’m thinking let’s say I want my Note app to drop in a photo from my Camera Roll, so the first time I go to do that it should pop up saying “hey we’d like to access your Camera Roll, and camera” because it might be that you want to just snap a photo, view the camera and drop that into the note immediately. Can we do it yes or no?”. So “yes”, obviously it’s fine you can do it. “No” that’s the users choice, that’s totally fine if they don’t want to, but I feel like I would like the opportunity once they’ve said no to kind of explain why it was we wanted it in more detail. and also to kind of explain now why the App doesn’t do half the stuff that I’ve kind of designed it to do, because you’ve said no.
So maybe the user could be taken to like a little screen where it explains quite clearly why we wanted this and what functionality it enables, because it might be that the user says no for like a privacy concern or or something else, I don’t know. But just an opportunity to put my case forward to be like, this is why we actually wanted it and without you saying yes you can’t have this stuff in the app, which we feel is kind of core to its functionality. And then say but if you do want it, do want to say yes anytime you can sort of maybe flick a switch here, or jump into your settings and just I guess kind of try and re-onboard the user for that particular piece of functionality, if that makes sense?
No it does it totally does. Those sort of screens are absolutely the right places, to have that button that the chucks them into into the settings screen. There’s another thing there as well. Some of the permissions that you asked for may only actually return once, so I think an example of that would be asking for the permission for the user to receive notifications, I think is set up in such a way that that the default prompt to say OK only ever actually shows to the user once per install of the app. So they would have to delete the app and reinstall it to then see that prompt ever again, and you as a developer only know that currently they don’t have permission
Yeah, so actually having that point of the default thing that shows when when there’s no access to these things, only asking for the the system prompt the first the first time around, asking for if it’s possible to do so, and then otherwise giving them that kind of negative flow that says “okay we can’t do this thing and you need to go to Settings”. Having that sort of fallback can be quite good because otherwise you may have developed it sort of thinking that you’re gonna show that prompt that asks for this thing every single time, and actually it doesn’t really do that. That’s something I’ve fell into before, I think locations preferences is another one but I’m not sure about the the Camera Roll itself.
Yeah. Yah exactly, whereas I think actually presenting them with something if you’ve asked once, and then keeping track of that, you know setting a default flag or something. Otherwise if it’s still locked out you’re then presenting that sort of a “we need this in order to give you this. Click here to go to settings to turn it on”, and I think that sort of flow can be really quite good
I mean at that point there’s friction isn’t there? You’ve already introduced friction, and that user can’t get what they want, and there’s friction in that they have to jump through some hoops to get it back again. if they do decide that is what they want. So yeah it’s just all a little bit unfortunate at that point isn’t it? So maybe I’ve seen it in a couple of a couple of places where in some apps you almost get like a splash screen, it explains that they’re gonna ask for permission for a certain thing, and they almost put up a box that looks like the actual prompt but it isn’t, and then the OS puts up the prompt that looks very similar. Then if – I’m painting about word picture here perhaps I’m trying to that –
– I’m trying to think (laughs). I saw it recently, it’s kind of like this screen came up saying “Oh hey we need to send you notifications, so please say yes.” and then they drew like a little alert box with yes on it. I went to tap it and it did nothing because it’s just a drawing that they put up and then the actual OS version, thagt you know iOS spits out.. That appeared and then I was like, oh okay. So I’m not sure where I’m going with this really, but I think that could be one way to ensure that you get the right answer the first time. Perhaps that kind of drawing that they they show, maybe they’ve got some kind of metric on it, that if you see it the first time you’re more likely when they actually pop up the OS version, you’ve kind of made that decision already before you see it. And they’re more likely to get the desired result
Yeah, just so it’s not such a shock, and the user’s like “Oh no I don’t know about that!” and then click no. So yeah, interesting. I’m not sure that’s the approach I would take but interesting nevertheless.
Okay we’ll call that a wrap, if you’ve enjoyed today’s show it’d be great if you could leave us a review on iTunes or if you could and leave us a recommendation in Overcast by hitting that star button that will help us reach even more like-minded people. Also we have our Slack channel we’d love to invite you to join, our hope is it can be a really great place for fellow developers to come and hang, out if you’d like to join just leave us a message on twitter @ WFRPodcast and we’ll get you signed up. So, Dave before we run off, where can people find you?