As many of you know, I use the C# programming language a lot for my Software Development work. With that being said, I often use some third party libraries in order to speed up development time and perhaps add some new features. However, the libraries I have listed here are used in every one of my C# projects. If your favorite C# Library is not listed. Please leave a link to it in the comments section so I can try it out. Let’s get started.
I specialize in making web and mobile applications and being able to parse and create JSON data is extremely important to me. Json.Net is a really useful tool for parsing and creating JSON data in your applications. It requires no setup, just add it to your project using Nuget and your now your ready to start working with JSON Data. I recommend that you spend some time reading the documentation so you know how to use the library effectively. Especially when dealing with nested elements in JSON Data. There is also a very active community around this framework in case you get stuck or get confused on the functionality. I cant recommend this library enough.
As many of you know, I’ve been contracted to create two mobile applications for some local small businesses. One common requirement for both of these applications is that the final product needs to be available on the iOS App Store and the Google Play Store. With this in mind, I figured I would try using Xamarin to create these apps. As I started working on these apps, I documented most of the initial thoughts via an older post on my blog. Since then most my problems have been resolved. However, I did notice it was hard to find good resources on how to build things using Xamarin Forms. I was able to find some old resources via some searches on YouTube, but I was not satisfied with the quality of the content. With this in mind. I wanted to take this opportunity to share what I have learned so far. Like my other Swift tutorials, we are going to start out small and work our way up. Let’s get started!
The ListView is a pretty common control in cross-platform mobile development. In Xamarin Forms, a ListView gets rendered out as a UITableView on iOS and a ListView in Android. You can create a ListView programmatically or you can use XAML. Once you have created your ListView you can access it in your code via its name property. Next, you have to assign an ItemSource to your ListView. In my case, I used a Generic List from the System.Collections.Generic Namespace. From there you populate your list with whatever data is going to be presented to the user. When your List is configured, set your List Object as the ItemSource property of your ListView. If you followed along with this post your app should compile fine and a ListView should show up on your device. If you encountered an error, check your code for errors as needed. Full code samples below. Happy Coding.
Over the last couple of weeks, I have made great progress on two apps that I’m writing. Working on these two projects every week has been a personal goal of mine since I started this blog, and I’m excited to see what the future holds. However, this progress means that the development process starts to slow down and the testing phase begins. This past weekend, I spent most of my time getting ready to move my apps into testing mode. During this time, I developed some tips in order to help newer developers get ready for testing.
At the time of writing this post, I have been blogging about my software development career for over a month. Without a doubt, this has been an awesome career move for me. Ever since I posted my very first post I’ve gotten multiple compliments on the design of this website. These comments specifically surprised me the most, since I’m not a designer at all. However, I’m willing to work on the design of my apps until it looks good. I realize that I have not talked about iOS development lately. Don’t worry, I just finished the iOS app for Park-Lane Tobacconist. I think the app turned out quite well, and I definitely have plans to write about some new topics I learned during the process of making that app. I also plan to expand my writing in the area of mobile development to include Xamarin. I recently took on a cross-platform mobile application project, as a reason to check out the latest versions of the technology. I’m still in the early stages of this new project but my early thoughts on using cross-platform tools will be coming out in the next couple of weeks.
If your new to mobile application development, one topic you should learn early on, is the concept of threading. Threading is a computer science term that handles the order of execution of tasks on the CPU. Threads are usually handled by the operating system. However there might be some tasks that can only be carried out on specialized threads created by the OS. To put things in context, consider the following example. Lets say I create an iOS application that uses a REST API to fetch data about upcoming concerts using location data. When you launch this application, the app freezes, takes a long time to load, and you see a white screen for more than 3 seconds. This is a common example of an app thats not optimized for the use of threads. As a result, you might receive complaints from your users saying that the app is slow or they delete your application all together. After a while, you decide to make some changes.
Upon inspection of your code, you find that your REST call is causing this slow down inside the ViewDidLoad method. you have to remember that in this case your code is being executed line by line. This means when your REST call is carried out, the CPU must finish getting your data before displaying it on screen. After reading this, you may be asking why does this happen? This happens because by default your application business logic and UI are loaded on the same thread called the main thread. Quick operations like simple math and string manipulation are perfectly fine on the main thread, but time consuming tasks like REST calls are not the best option. So how do we fix this? The simplest thing we could do is move this time consuming task to what is called the Background Thread. The Background Thread is a thread designed for complex operations. In return you leave the Main Thread open for UI changes. Here is some example code on how to make this happen.