Week 39: Reading Notes

October 01, 20235 min read#swift, #reading, #llm

Improve the build times of your SPM Packages and your apps

Link: https://www.manu.show/2023-08-18-improve-build-times-in-spm-packages-and-in-your-apps/

Get ready to uncover some of the secrets of faster build times – an investment that’s not just about speed, but about creating a more satisfying and efficient development journey for you and your entire team.

Why is code quality crucial in iOS apps? Explained with memes.

Link: https://swiftandmemes.com/why-is-code-quality-crucial-in-ios-apps/

1️⃣ Quality is an integral part of the Definition of Done (DOD) and one of the most important deliverables of every user story.

2️⃣ Quality is always expected: no matter what the business tells you, they’ll always expect the highest quality of your services as a developer.

3️⃣ A messy codebase has more profound consequences than just wasted money. Enter the cost of poor morale in the team.

4️⃣ Delivering fast != delivering crappy code

5️⃣ You shouldn’t need to ask for permission to produce good quality code! Always treat yourself as a highly trained professional: a doctor or an architect. People expect these specialists to solve their problems, but don’t dare tell them how to do their jobs.

6️⃣ Remember about keeping the score. Only the measured parameters have any chance of improving. If you want to raise e.g. unit test coverage across the project, you would not succeed unless you ensure this value is accurately measured and easily available within the team. A great idea is to use xcov plugin for Danger to annotate your PRs with overall coverage level.

Generate RESTful APIs with Swift in 2023

Link: https://blog.eidinger.info/generate-restful-apis-with-swift-in-2023

In this blog post, I describe my experience using Swift OpenAPI Generator to generate a fully functional client API.

Shift-Left iOS Testing with Focus Flows

Link: https://eng.lyft.com/shift-left-ios-testing-with-focus-flows-c9e050bd2095

Shift-left testing is an approach to software testing and system testing in which testing is performed earlier in the lifecycle (i.e., moved left on the project timeline) A Focus Flow is a mini application that’s independent of other modules and compiles a smaller (“focused”) flow of a specific product feature. It runs in a reduced environment which carries both the session state (configs, feature flags, service state, user account) and device state (device settings, simulated locations, stored values) that is expected for the feature to function properly. Running our tests with Focus Flows has reduced execution time and flakiness by enabling us to skip irrelevant steps in test scenarios. Although Focus Flows provide an excellent tool for iterating and testing quickly and reliably, they haven’t replaced our smoke tests or end-to-end test suite since they’re focused on smaller features of the app while smoke tests are focused on broader end-to-end workflows. Nonetheless, Focus Flows have been an excellent addition to our testing strategy, and help us to quickly deliver features with the best possible quality.

An explosion in software engineers using AI coding tools?

Link

GitHub just published a survey about developer productivity and AI coding tools. The company hired an external research agency to survey 500 US-based software developers who work at large, 1,000+ person organizations.

What do AI coding tools help the most with? The survey lists the top 3 areas mentioned by developers:

  • Learn: Develop coding language skills (57%)
  • Productivity: become more productive (53%)
  • Focus: spend more time building and creating, less on repetitive tasks (51%)

Get all available cameras in iOS using AVCaptureDevice.DiscoverySession

Link

Problem: `AVCaptureDevice.devices()“ is deprecated

Solution:

func getWideAngleCamera() -> AVCaptureDevice? {
    // Start a discovery session to find all available cameras on your device.
    let deviceDiscoverySession = AVCaptureDevice.DiscoverySession(deviceTypes: [.builtInDualCamera,
                                                                                .builtInDualWideCamera,
                                                                                .builtInTripleCamera,
                                                                                .builtInWideAngleCamera,
                                                                                .builtInTelephotoCamera,
                                                                                .builtInUltraWideCamera],
                                                                    mediaType: AVMediaType.video,
                                                                    position: .unspecified)
    // Get the first camera at the back. This may either be a single camera lens, or a camera system
    // depending on the device you're using.
    if let camera = deviceDiscoverySession.devices.first(where: { $0.position == .back }) {

        // If the camera is a single lens system, then we can return the wide angle camera thats been
        // found (.builtInWideAngleCamera). If the camera is a type of `.builtInDualCamera` camera system
        // (iPhone X class devices), then we can also return the camera as by default the wide angle lens is selected.
        if camera.deviceType == .builtInDualCamera || camera.deviceType == .builtInWideAngleCamera {
            return camera
        }

        // If its none of the above devices, we can use `virtualDeviceSwitchOverVideoZoomFactors` to find
        // out what where the zoom factors are where the virtual camera system switches over lens'.

        // By default, the camera systen will start using the lowest zoom factor (0.5x, i.e the ultra-wide lens),
        // so the wide-angle lens will be the first in the `virtualDeviceSwitchOverVideoZoomFactors` array.

        if let wideAngleZoom = camera.virtualDeviceSwitchOverVideoZoomFactors.first {
            let _ = try? camera.lockForConfiguration()
            camera.videoZoomFactor = CGFloat(truncating: wideAngleZoom)
            camera.unlockForConfiguration()
        }
    }   return nil
}
Quick Drop logo

Profile picture

Personal blog by An Tran. I'm focusing on creating useful apps.
#Swift #Kotlin #Mobile #MachineLearning #Minimalist


© An Tran - 2024