Ariel Elkin, Mar 29
Editorial: Mobile and the 2017 Developer Survey Results
Stack Overflow has recently published the results of its 2017 Developer Survey. It consisted of about 100 questions covering all important aspects of a developer’s professional life: from attitudes towards programming language to salaries, including important yet overlooked topics such as what would developers choose for performance metrics. Now in its seventh year, the Developer Survey is gathering and quantifying important information about us and our industry. Let’s take a closer look at what it says about mobile. Of the 51,392 respondents who provided usable responses, 23% considered themselves mobile developers. Note that respondents could select more than one category, and the survey doesn’t clarify what percentage of developers consider themselves primarily mobile developers. What we can nonetheless infer is that 77% of developers do not consider themselves mobile developers. In other words, we are a minority.
Josh Marchello, Mar 28
Sourcehunt - Swift Edition - March 2017
Ariel Elkin, Mar 22
Editorial: Put Your Code Where Your Mouth Is
We may be familiar with Siri, Google Now, and Cortana as the mobile operating system’s native voice-operated assistants, but Apple has gone a step further and published an API that allows developers to recognise speech and make use of it. iOS users are already used to Siri to interact with apps and dictate text, and now developers have direct access to that text. With great power comes great responsibility, as they say on the web. What are some new powers we are getting thanks to this technology, and what are some of the risks?
Deivi Taka, Mar 22
iOS Speech APIs Tutorial
With the launch of iOS 10 developers can make use of a new exciting API: Speech Recognition. The concept of translating audio to text is known to both the users and the developers. iOS has offered this feature through Siri, and its keyboard dictation button in the previous versions. Yet, the new framework has more benefits and is easy to implement, as you are soon to discover. The code for this article can be downloaded on GitHub. Dictation was hard to work with, because of its limitations. It was possible to access it only through the default keyboard, or elements that support TextKit. If the keyboard language wasn’t supported, too bad for you! Recognition could only be performed on live audio, and all you had in return was plain text. That could be more than enough for certain apps, but you may want to do a little more. The API offers more functionalities to the developers. It allows them to use the framework anywhere in their app, without the need of the keyboard presence. Audio can be given as input from a pre-recorded file, or a live source. In both cases, you have control on when to start and stop the operation, which was not possible before. Additionally, the language can be set regardless of the system language. You can choose between over 50 available languages.
Clay Unicorn, Mar 21
Server-Side Swift: Comparing Vapor and Perfect
One of the reasons Swift has become a major player in web development is that there is a variety of great quality frameworks to build web apps. Not all frameworks are created equal, and not all frameworks _feel_ equal. My goal here to compare Perfect and Vapor in terms of their popularity, ease-of-use, features, and community; in order to help you decide which framework is right for you. Vapor has the private backing of a consultancy and Perfect raised $1.5 million in seed funding last year. With the social foothold that Perfect has both in seniority and numbers, one could say that it's the most popular. Then again, Vapor released version 1 in September of 2016 (four months old at the time of this publication) and has risen in popularity to nearly match Perfect in stars and public activity. Popularity is hard to quantify, so here are the facts as of March 2017, and I'll let you decide:
Bob Lee, Mar 15
Store UIColor with UserDefaults in Swift 3
This article was originally published at iOS Geek Community. So, what the heck is UserDefaults in the first place? Why is the name so ugly? Why are we using it? and Why am I writing about it? If you can give at least one answer to these questions, you may skip to Part 2 where I talk about UIColor. Prerequisite: Understand Type Casting from the bottom of your heart. In other words, be able to distinguish between as, as!, as? You can start off with this video where I show my face and speak English on YouTube. As a tradition, let’s start off some funky and tangible ways to understand UserDefaults at an extremely high level. Actually, this is too simple. I don’t think it’s necessary. The UserDefaults object saves user data. So that when you first download an app, you can save preferences such as a background color/image even when the battery kills itself. It can save ALL kinds of things. If you have 254GB of free space on your phone, it can save 254GB of user data. But, there is a big problem. It regurgitates everything during the runtime. Okay, the previous sentence can be a bit ambiguous. Let’s try this. It will vomit everything out when you first launch an app or the view is loaded. Hmm. Here is the better way. It’s like you running to the bathroom and taking a poop that you’ve been holding for 5 days at once. What happens to your body? You get overwhelmed. It may not even come out right, and most importantly, it will hurt you real bad. Same thing, you want to make sure you only carry enough of poop inside of the large intestine so that you (iPhone) can take care of and handle like a boss. LOL. Yeah, for those newcomers, this is how I think and execute. Excuse me. No one can stop me.
Said Sikira, Mar 14
Improve Your Swift Closures with Result
Dealing with asynchronous tasks is an everyday developer task, and Swift developers mostly use closures for this type of work. Their syntax is clear and expressive, but handling a closure may be error-prone when we don’t adequately represent the results of an asynchronous operation. Result-oriented programming aims to reduce that complexity by providing a simple way to represent these results. This article will go through the basics of closures and show you how to use Result in your code. All examples can be found in this Github repository. Closures are self-contained blocks of code. They can be passed around and used in your code as any other object. In fact, closures have types, in the same way Int or a String are types. What makes them different is that they can have input parameters and they must provide a return type.
Design & UX
Mateo Prifti, Mar 14
How to Turn Your Sketch Files into Working Prototypes with Origami
Sketch is a great for UI Design, but it stops at flat designs. Mateo shows you how to do sophisticated prototyping with Sketch files in Facebook Origami.
Ariel Elkin, Mar 13
Editorial: Getting Great Results with Swift
Klevis Davidhi, Mar 08
UICollectionView DataSourcePrefetching Example and Explanation
Recently, Apple announced a new UICollectionViewDataSource protocol extension called UICollectionViewDataSourcePrefetching. This extension makes it possible to implement two new functions that deliver a completely smooth scrolling performance. This tutorial will show you how to use it. Open Xcode and create a new project based on the Single View Application template. Before you do anything else, in order to improve the appearance of our application ,select the view and choose Editor -> Embed In -> Navigation Controller. Now drag a Collection View from the Object Library onto the view canvas and adjust its size . Notice that into the Collection View is one reusable cell , so click under the Attributes Inspector and give this cell an Identifier, let’s call it foodCell. Drag an UIImageView onto it and adjust its size to fit the content.
Bob Lee, Mar 07
Pass Data with NSNotification between ViewControllers in Swift 3
This article was originally published at iOS Geek Community. Today, let’s talk about how and why we use NSNotification to pass data and communicate/notify between classes and structs. By the way, NSNotification, unlike its name, has nothing to do with Push Notification — rookie mistake 101 (me). Yes, there are many ways to pass data in Swift: Delegate, Key-Value Observing, Segue, and NSNotification, Target-Action, Callbacks. However, each one has its own pros and cons. They are like dining utensils. For example, I wouldn’t use chopsticks — although it’s pretty darn good — to drink soup. Since there are many, I’m only going to cover one at a time, and I will going to mention why you should spoons instead of chopsticks along the way. It doesn’t make sense to tell the differences between chopsticks and knives before I have used both.
Ariel Elkin, Mar 01
Editorial: Swift Month
We’re dedicating the month of March 2017 to the Swift Language. Swift is one of the most loved languages by developers (if not the most loved). And this in a relatively short period of time after being released. I think this ascent can be explained by looking at how matters stood right before its introduction, when iOS and macOS developers spoke Objective-C. This was (and still is) a venerable language, actively used for more than 20 years. But its age was starting to show, especially when it came to its proneness to unsafe code (lack of type safety, null pointer exceptions, cumbersome error handling, the list goes on). After taking your first few steps with Swift, you’d soon realise that this was a language designed by someone who was tired of Objective-C’s problems. The language was designed with code safety in mind: type safety, safe initialisation, value types, and many more things that were sorely missing from its predecessor.
Ariel Elkin, Mar 01
Swift: Probably The Best Full-Stack Language in the World
Ever since its release in 2014, Swift went through multiple iterations in order to become a great full-stack development language. Indeed: iOS, macOS, tvOS, watchOS apps, and their backend can now be written in the same language. Backends can be written in many other languages – but let us argue why Swift is probably the best full-stack language in the world for mobile developers. Safety. An essential advantage of Swift as a perfect back-end programming language is the safety built into the language. Swift does away with entire classes of errors and crashes. Remember null pointer exceptions? Those that cause crashes when objects you expect not to be nil are accidentally nil. Swift’s optionals let you know in advance if an object may be nil, and if so, force you to adequately handle the nil case. Safe initialization prevents you from ever initialising an object such that it ends up being nil. Remember unrecognized selector sent to instance crashes? Swift is type-safe meaning that if you’re calling a function on an object that doesn’t respond to it, the error will be caught by the compiler and not at runtime. Yet Swift was explicitly designed to be familiar and practical, rather than to adhere to some particular programming dogma. That said, as Chris Lattner puts it, “the defaults encourage safety and predictability”.
Stanley Idesis, Feb 28
Low-Code Mobile Basics with OutSystems
Stanley Idesis looks at low-code platforms that save developers time with boilerplate mobile development tasks.
Enrico Sustayo, Feb 22
An Introduction to Messages Extensions on iOS
Theodhor Pandeli, Feb 21
Integrating the Facebook Graph API in Android
In this tutorial, I will show how to send requests and get data from Facebook using Graph API. You can find the project on Github In order to perform requests to Graph API, the user must be logged in with the Facebook SDK for Android. I am not going to explain how to set up the login process in this article. You can find the Facebook Login Integration article here Watch every action your users perform in your app! Make sure you have an up to date version of Android Studio. I am using version 2.2.3 Open Android Studio and create a New Project, naming it as you wish. Click Next, choose Minimum API level 17 and click Next again. Choose Empty Activity as the first activity, name it LoginActivity and click Finish.
Ariel Elkin, Feb 15
Editorial: Which Planet of the Apps Are We On?
If you haven’t heard that Apple is launching a TV show about app-making, then, I wonder… which planet you’re living on? The trailer for the new show promises the following: In every episode, app developers work to earn millions of dollars in venture capital investment. It begins with a pitch to four of the world’s most culturally influential entrepreneurs. […]. It all leads to a final pitch with one of the hottest venture capital firms on the planet. The developer community’s reception, so far, has been negative. Rock Star Developer and maker of Instaper Marco Arment tweeted: I’m sure Planet of the Apps will be a great show for all of those people who bug developers with their awful ideas. But actual developers… Well, this likely has about as much relevance to reality as most “reality” shows. Aside from the fact that judging a show purely by its trailer is, shall we say, unwordly, I say: Think different, content-creation is an avenue that Apple has much exploration to do in, and they have the resources required for it (visibility, money, domain knowledge, and talent). Consider this an experiment. Worst case scenario; mobile apps gain more visibility. Best case scenario? The perceived value of apps and your job becomes higher. You’d be automatically promoted from Rock Star to Rock Legend.
Craig Buckler, Feb 15
How to Simulate Mobile Devices with Device Mode in Chrome
A quick look at how to enable Chrome's useful new Emulation Mode to emulate dozens of mobile devices.
Rodrigo Cericatto, Feb 14
Phone callbacks in Android Using TelephonyManager
If you are an Android Developer and you need to detect if your phone is in idle state, off-hook (receiving state) or ringing state, this tutorial was created for you. The objective here is to show you how to implement phone callbacks in Android, allowing detection of calls to your phone. In this topic, the most important class that will be talked about is the TelephonyManager. This class uses a listener called PhoneStateListener to listen for telephony service updates. An object of type TelephonyManager will be instantiated, and it will listen for updates of Context.TELEPHONY_SERVICE. In order to monitor updates of telephony states like PhoneStateListener.LISTEN_DATA_CONNECTION_STATE, PhoneStateListener.LISTEN_CELL_INFO and others, a class called PhoneCallback will be created, extending from PhoneStateListener. With TelephonyManager the telephony services of a device can be accessed and with the method TelephonyManager.listen(PhoneStateListener listener, int events) all information the telephone is receiving can be monitored. The class PhoneStateListener receives callbacks when some event of TELEPHONY_SERVICE is observed. In this tutorial, the flag PhoneStateListener.LISTEN_CALL_STATE will be used. It will monitor and listen to the call state of the phone. As can be read in the PhoneStateListener documentation (see section “Further Reading” below), there are other constants that can be set into the argument int events of the method TelephonyManager.listen. For instance: LISTEN_SIGNAL_STRENGTHS listens for changes to the network signal strengths (cellular). But in this tutorial, the flag LISTEN_CALL_STATE will be used, which listens for changes to the device call state.
Jose Rosario, Feb 13
Achieve 60 FPS Mobile Animations with CSS3
Animating elements in your mobile application is easy. And doing it the right way is easy, too... if you follow our tips here.
Xuyen Bowles, Feb 08
Why We’re Fearful of Health and Fitness App Security
Health and fitness apps have changed the way we exercise, eat, and even sleep. Hundreds of thousands of these diverse apps exist — more than 165,000 at last count. While these apps are serious about counting our calories, and tracking our sleep cycles, very few of them take security as seriously as they should. An incredible 90% of mobile health apps have seriously risky security vulnerabilities. Given the wealth of valuable health and personal information these apps can contain, this is troubling — the app that’s smart enough to count users’ steps, or remind them to take their blood pressure meds, may be leaving these users (and their personal information) vulnerable to hackers. If that wasn’t enough, a study from the Future of Privacy Forum found that only 60% of health and fitness apps had privacy policies; compared to 76% of general apps. What implications does this have for those of us developing health and fitness apps for a loyal and trusting user base? Are we putting consumers in danger if they use our apps to keep a food log or monitor their REM sleep cycles? How can we keep our customers’ information safe and private, while still offering top-notch digital tools for their fitness and wellbeing?
Amit Diwan, Feb 07
Android App Accessibility Checklist
Developers and designers of mobile applications must always focus on ensuring accessibility for vision and hearing impaired users. This article will offer some checklists you should complete to ensure your application is more accessible. While working on any app, users rely on touchable controls. The controls should have appropriate size and be easily visible. Your app should have controls with a minimum of 48dp in length as well as width. It is approximately equal to 9mm and recommended for controls for which a user can select or take an action. In the below figures, you can see the correct and incorrect ways of sizing buttons. EditText is a control which configures itself to be editable. For ensuring accessibility, add an android:hint attribute for EditText fields. Adding the attribute will help users in understanding what content is written when the text field is empty. The content of the android:hint attribute can be spoken.
Valdio Veliu, Feb 01
Mastering Complex Lists with the Android RecyclerView
Valdio Veliu looks at the RecyclerView in Android, perfect for handling long lists of data efficiently.
Deivi Taka, Jan 31
Understanding iOS Proactive Suggestions
With the introduction of the “Proactive” feature in iOS 9, Apple is trying to proactively assist you. The system learns from your actions and attempts to anticipate them. It starts showing suggestions, recommendations, apps you frequently use, etc. The Handoff feature hasn’t changed but the space usually reserved for it in the lock screen is used for suggested apps. Apps shown in the bottom-left corner of the lock screen and in the app switcher are based on your location or habits. The following screenshots show quick access to the Music app when I plug in my headphones. iOS has noticed that when I plug in my headphones, I immediately go to the Music app, so it now gives me quicker access to it. The same will happen for an app that uses location. It will appear when you are near your favorite restaurant, for instance. Spotlight search can be reached from the home menu; by swiping down or by swiping all the way left. The first thing to notice are the Siri suggestions below the search bar. By default, you’ll see the 4 apps you are likely to use at that given time (of the day or night), but it can be expanded up to 8 apps. It also depends on your location, or on whether your headphones are plugged in. So Siri suggests apps depending on your previous behavior or on the time of the day. In the screenshot below on the left, Siri has suggested messaging apps and a game I currently play. Notice that in the screenshot on the right, the suggestions change as I plugged in my headphones. Just as in the previous example, the system is trying to help access the Music app quicker.