MobilePro#150: Prompt Engineering for Devs, TypeScript in 2024 Doesn't Make Sense, iOS System Architecture, Android Accessibility Checklist, SeekTune.
Hi,
Welcome to the mobile app development world with the 150th edition of _mobilepro! We are grateful for your readership and continued support.
In this edition we cover mobile development community discussions on:
In our relatively new section captures internet jibber-jabber about the mobile ecosystem:
[Sponsored] Learn Million Dollar AI Strategies & Tools in 3 hours (Free Workshop)
A deep dive into how developers trick App Store review into approving malicious apps
Sonos’ $30M app fail is cautionary tale against rushing unnecessary updates
Demo: Predicting social science experimental results using LLMs
Today's news covers release stories on Android and Flutter. And if you are currently developing an iOS app, checkout this week's resources on iOS tools. Don’t miss this week’s tutorial from the book ‘C# 12 and .NET 8 – Modern Cross-Platform Development Fundamentals’ .
P.S.: If you have any suggestions or feedback, or would like us to feature your project on a particular subject, please write to us. Just respond to this email!
If you liked this installment in our new series, fill in our survey below and win a free PDF on your Packt account.
Thanks,
Apurva Kadam
Editor-in-Chief, Packt
Advance Your Knowledge in Tech!
Next Gen Learning - AI-powered Assistants for Every Title Published after 2023!
Get unlimited access to 7000+ expert-authored eBooks and video courses covering every
Try it yourself - Start your Trial!
Mobile App Dev Community Speak
What are Mobile developers discussing? What are the latest tips and tricks? Shortcuts and experiments? Cool tutorials? Releases and updates? Find it all out here.
Prompt Engineering for Developers: 11 Concepts and Examples - Prompt engineering is one of the best places to start in this era of AI. Understanding the core concepts will help you get the most out of generative AI models like ChatGPT, Google Bard and Claude for tasks such as debugging, code translation, and generating tests including any general task. We will cover all the core concepts and principles with very detailed examples of Prompt Engineering. Let's jump in.
Why Hating TypeScript in 2024 Doesn't Make Sense - I've been seeing this trend lately: more and more developers bashing TypeScript. The gripes range from it being "too complex" to "slowing down development." While not all concerns are unfounded, hating on TypeScript in 2024 just doesn't add up. Let’s break it down.
iOS: The System Architecture - Fun fact: iOS (for mobile devices) and OS X (now called MacOS) have similar architectures. The main difference is at the topmost layer because people interact with mobile devices and laptops differently. This article aims to analyze each layer of iOS's system architecture (above the hardware) in a digestible format. Let's begin.
How to Add SVGs to Your React Native App: A Quick and Simple Guide - SVGs (Scalable Vector Graphics) are a fantastic way to add crisp, scalable graphics to your React Native app. They’re perfect for icons, logos, and illustrations because they look sharp at any size. Here’s a quick and easy guide to help you get started with SVGs in React Native.
Android Accessibility Checklist - As part of my thesis, I developed an accessibility checklist for Android developers. While completing all the checks doesn't guarantee that your app is 100% accessible, the checklist aims to help catch many possible accessibility problems. In this blog post, I'll first share a bit about the development process and then share the checklist. If you're curious, the whole checklist with accompanying material is behind the following link: Android Accessibility Checklist.
Mobile App Dev Repos
Check this space for new repos, projects and tools each week! This week we bring you a collection
of iOS tools for Images.
JMCMarchingAnts - Library that lets you add marching ants (animated) selection to the edges of the images.
ImageViewer - An image viewer à la Twitter.
FaceAware - An extension that gives UIImageView the ability to focus on faces within an image when using AspectFill.
SwiftyAvatar - A UiimageView class for creating circular avatar images, IBDesignable to make all changes via storyboard.
ShinpuruImage - Syntactic Sugar for Accelerate/vImage and Core Image Filters.
Internet Jibber-Jabber
Interesting stories and curious musings from the Internet.
SeekTune - SeekTune is an implementation of Shazam's song recognition algorithm based on insights from these resources. It integrates Spotify and YouTube APIs to find and download songs.
A deep dive into how developers trick App Store review into approving malicious apps - We recently reported on how multiple pirate streaming apps for iOS managed to get approved on the App Store by tricking the review process. Although we briefly mentioned some of the techniques used by these developers, 9to5Mac has now taken a deep dive into how these apps are engineered to trick Apple.
Self-Compressing Neural Networks - This work focuses on reducing neural network size, which is a major driver of neural network execution time, power consumption, bandwidth, and memory footprint. A key challenge is to reduce size in a manner that can be exploited readily for efficient training and inference without the need for specialized hardware. We propose Self-Compression: a simple, general method that simultaneously achieves two goals: (1) removing redundant weights, and (2) reducing the number of bits required to represent the remaining weights.
Sonos’ $30M app fail is cautionary tale against rushing unnecessary updates - Addressing blowback from Sonos' wildly unpopular app redesign will cost the company $20 to $30 million "in the short term," according to CEO Patrick Spence. In May, Sonos launched an updated app that aggravated many users due to its removal of common functions, like accessibility features and the ability to edit playlists and song queues, use sleep timers, and access local music libraries. Sonos said it wanted to modernize the app's interface and make it easier to navigate. While the app initially succeeded in making certain things quicker, like adjusting the volume, the changes caused outrage among Sonos' typically loyal userbase. In July, Spence apologized for the maligned redesign and said Sonos would fix the app with biweekly updates.
Demo: Predicting social science experimental results using LLMs - This demo accompanies the paper Prediction of Social Science Experimental Results Using Large Language Models and can be used for predicting experimental treatment effects on U.S. adults. To manage costs of hosting this demo publicly, it uses GPT-4o-mini rather thanGPT-4. This tool uses Large Language Models (LLMs) to predict experimental treatment effects on survey outcomes for U.S. adult samples. Users can select a dependent variable and one or more text-based treatment messages. The tool uses an LLM to simulate American participant responses in an RCT experiment. It then displays the predicted treatment effect for each treatment. Note that this is a technical demo, and not a substitute for conducting experiments with real human participants.
Mobile App Development Tutorial
Splitting a complex comma-separated string
Earlier in this chapter, you learned how to split a simple comma-separated string variable. But what about the following example of film titles?
"Monsters, Inc.","I, Tonya","Lock, Stock and Two Smoking Barrels"
The string value uses double quotes around each film title. We can use these to identify whether we need to split on a comma (or not). The Split method is not powerful enough, so we can use a regular expression instead.
To include double quotes inside a string value, we prefix them with a backslash, or we could use the raw string literal feature in C# 11 or later:
Add statements to store a complex comma-separated string variable, and then split it in a dumb way using the Split method, as shown in the following code:
// C# 1 to 10: Use escaped double-quote characters \"
// string films = "\"Monsters, Inc.\",\"I, Tonya\",\"Lock, Stock and Two Smoking Barrels\"";
// C# 11 or later: Use """ to start and end a raw string literalstring films = ""
""Monsters, Inc.","I, Tonya","Lock, Stock and Two Smoking Barrels"""";
WriteLine($"Films to split: {films}");
string[] filmsDumb = films.Split(',');
WriteLine("Splitting with string.Split method:");
foreach (string film in filmsDumb)
{
WriteLine($" {film}");
}
Add statements to define a regular expression to split and write the film titles in a smart way, as shown in the following code:
Regex csv = new(
"(?:^|,)(?=[^\"]|(\")?)\"?((?(1)[^\"]*|[^,\"]*))\"?(?=,|$)");
MatchCollection filmsSmart = csv.Matches(films);
WriteLine("Splitting with regular expression:");
foreach (Match film in filmsSmart)
{
WriteLine($" {film.Groups[2].Value}");
}
In a later section, you will see how you can get a source generator to auto-generate XML comments for a regular expression to explain how it works. This is really useful for regular expressions that you might have copied from a website.
Run the code and view the result, as shown in the following output:…read more.
Read the ‘C# 12 and .NET 8 – Modern Cross-Platform Development Fundamentals’ book now!
What's Happening in Mobile App Dev?
Latest releases, updates, launches and news on mobile app dev!
Android
Android Device Streaming: Announcing Early Access to Samsung, Xiaomi, and Oppo Device Labs - At Google I/O 2024, we announced Android Device Streaming in open beta, which allows you as a developer to more easily access and interactively test your app on real physical devices located in Google data centers and streamed directly to Android Studio. This enables teams in any location to access a variety of devices across top Android device manufacturers, including the latest family of Google Pixel and Samsung Galaxy series devices.
We’re significantly expanding on the diversity of devices available in this service by working closely with Android device manufacturers (also known as original equipment manufacturers, or OEMs)—such as Samsung, Xiaomi, and Oppo—to connect their device labs to Android Device Streaming, so you can access even more physical devices directly in your workflow in Android Studio.
Android Studio Koala Feature Drop | 2024.1.2 RC 1 now available - Android Studio Koala Feature Drop | 2024.1.2 RC 1 is now available in the Beta channel. For information on new features and changes in Android Studio Koala Feature Drop, see the Android Studio Preview release notes. For details of bugs fixed in each previous release of Android Studio Koala Feature Drop, see closed issues.
Flutter
Announcing Flutter 3.24 and Dart 3.5 - An early look at Flutter GPU, web enhancements, and more! We’re unveiling Flutter 3.24 and Dart 3.5 alongside the last stop in the I/O 2024 Connect series, happening in just a few hours in China — one of Flutter’s most prolific communities in the world, making this moment very special.
Getting started with Flutter GPU - The Flutter 3.24 release introduces a new low-level graphics API called Flutter GPU. There is also a 3D rendering library powered by Flutter GPU called Flutter Scene (package: flutter_scene). Both Flutter GPU and Flutter Scene are currently in preview, only available on Flutter’s main channel (due to reliance on experimental features), require Impeller to be enabled, and might occasionally introduce breaking changes.
What’s new in Flutter 3.24 - Flutter 3.24 is packed with exciting new features and enhancements to elevate your app development experience. This release highlights the preview of Flutter GPU, which enables advanced graphics and 3D scenes directly in Flutter. Web apps can now embed multiple Flutter views, enhancing your app’s versatility. And finally, we’ve added video ad monetization support to help you maximize revenue.
And that’s a wrap. I am off to an adventure in the coming week so the next issue will be published on August 23.
P.S.: If you have any suggestions or feedback, or would like us to feature your project on a particular subject, please write to us. Just respond to this email!