Bluesky vs X

The post-US electron “X-odus”, the migration of users and companies off of X/Twitter, represents one of, if not the, biggest moments in the history of Internet-based social media. Long the stuff of dreams, the concept of a federated social media landscape, one where individuals own and control their media selves, is finally gaining traction.

You can listen to a twenty minute AI generated podcast discussing this post by clicking or tapping on the link below. Note that the two AIs in this conversation decided to pronounce Bluesky as “blue-ski” rather than “blue-sky”. Distracting at first but you’ll get used to it.

Federated social media networks operate on decentralized communication, enabling users to engage and communicate across various platforms while maintaining data ownership and control. Unlike centralized social media networks such as X (formerly Twitter) and Facebook, where all data, content, and user interactions are governed and hosted by a single company, federated networks distribute these functions across multiple interconnected servers (instances), providing greater autonomy, flexibility, and user control.

Key Concepts of Federated Social Media Networks:

  1. Federation Model:

    • Federated networks comprise numerous independently operated servers (or instances) communicating using standard protocols.
    • Each server can enforce its moderation policies, create specialized communities, and allow communication with users across other servers.
  2. Protocols in Federation:

    • Federated networks rely on open protocols such as ActivityPub, an open standard for social networking. It defines how servers send and receive updates (e.g., posts, follows, likes) across the network.
    • By contrast, networks like Bluesky are developing new protocols, such as AT Protocol (Authenticated Transfer Protocol). This protocol aims to create a highly flexible social web, allowing user portability, algorithmic transparency, and enhanced interoperability among different social platforms.
    • ActivityPub powers platforms like Mastodon, while the AT Protocol distinguishes Bluesky by emphasizing decentralized identity management, account portability (users can switch providers while keeping data and followers), and user-defined algorithmic preferences.
  3. Centralized vs. Federated Networks:

    • X (formerly Twitter) and Facebook:
    • Operate as centralized networks where all data resides within their servers.
    • These platforms control content moderation, user data, algorithms, and visibility. User interactions are limited to the boundaries defined by each network’s rules and policies.
    • Users must abide by the corporate policies and experience whatever changes or monetization strategies the central entity implements.
    • Federated Networks like Bluesky:
    • Allow distributed ownership and hosting. Each server (or instance) can create rules, offer niche communities, and remain interoperable with other federated instances.
    • Bluesky’s AT Protocol promotes “decentralized social networking,” offering features like account portability, algorithmic choice, and enhanced data interoperability, where users can bring their followers and data across different platforms using the protocol.
  4. Data Portability and Ownership:

    • Centralized platforms typically retain control over user data, while federated networks empower users with more significant data sovereignty.
    • Federated platforms emphasize data portability, allowing users to change instances without losing followers or content. For instance, Bluesky’s AT Protocol enables users to switch servers seamlessly without losing their social graph (connections).
  5. Moderation and Governance:

    • Federated networks delegate moderation to individual servers or community moderators. This powerful feature allows for more tailored and community-driven moderation approaches than centralized platforms, where content moderation is often top-down and algorithm-driven.
    • Individual instances can block or filter interactions with other servers based on their content policies, fostering diverse community guidelines and moderation styles.
  6. Customization and Interoperability:

    • Federated networks encourage diverse experiences across different servers, allowing users to choose or create instances that reflect their community values and user needs.
    • Bluesky’s AT Protocol emphasizes user control over content feeds and algorithmic curation, letting users select or build algorithms to tailor their social media experience. In contrast, centralized platforms like X and Facebook control the content algorithms users see.

Summary Comparison:

• X (Twitter) / Facebook:
• Centralized.
• Controlled by a single company.
• Content moderation and algorithmic curation determined by the platform.
• Limited data portability and user control over data.
• Extensive reach, single global network.
• Federated Platforms (e.g., Mastodon, Bluesky):
• Decentralized and distributed.
• Multiple independent servers (instances) governed by community rules and protocols like ActivityPub (Mastodon) or AT Protocol (Bluesky).
• Content moderation and algorithmic choices are flexible and community-driven.
• Emphasis on user control over data, greater portability, and transparency.
• Interoperability across different instances and platforms, creating a “network of networks.”

Bluesky and the Future of Federated Social Media:

Bluesky’s goal with the AT Protocol is to improve upon traditional federated models by introducing a more user-friendly and flexible approach, emphasizing decentralized identities, content customization, and true data portability. While ActivityPub provides a widely adopted model for decentralized social networking, the AT Protocol aims to elevate federation to broader, more user-focused social interoperability. This evolution represents a shift from centralized social control to a more user-empowered and open framework, potentially leading to a more democratized social media landscape.

Cover image created by Midjourney V6.1.

Starter Prompt: a distributed social network spanning North America and Europe as seen from space –ar 3:2 –style raw –c 20 –s 50 –v 6.1

Centaur Programming Podcast

This year Google released their NotebookLM. This free service lets you upload PDFs, websites, YouTube videos, audio files, Google Docs, or Google Slides, and NotebookLM will summarize them and make interesting connections between topics, all powered by Gemini 1.5’s multimodal understanding capabilities.

It also has the ability to generate compelling and professional sounding podcast audio files from any URL.

Click the audio player below to listen to a nine minute podcast that NotebookLM created based on my recent blog post about the Centaur Programming development approach.

Centaur Programming: Enhancing Human Coding with AI Collaboration

cen·taur [ˈsenˌtôr] noun, greek mythology

  1. a creature with the head, arms, and torso of a man and the body and legs of a horse: 
  2. “in Greek mythology, centaurs were notorious for their wild behaviour.”

In 1997, world-famous chess grandmaster Garry Kasparov faced a historic match against IBM’s supercomputer Deep Blue. After defeating an earlier version of the machine in 1996, Deep Blue unexpectedly defeated Kasparov on May 11, 1997, with a final score of 3.5 to 2.5. This stunning event marked the first time a reigning world chess champion lost a match to a computer under standard tournament conditions. Inspired by this event, Kasparov developed the concept of “centaur chess,” also known as advanced chess,” where a human player teams up with a computer. The idea was to combine human intuition and creativity with the brute-force calculating power of AI, creating a new form of chess that could elevate strategic play to unprecedented levels.

Warp ahead nearly 30 years, and, thanks in no small part to the development of Google’s transformer deep learning architecture and the emergence of thoughtful reasoning seen with the o1-preview release of ChatGPT, the same collaborative approach to what we used to call “paired programming” is beginning to emerge with the concept of “centaur programming.”

Centaur programming is a hybrid approach where human programmers collaborate closely with artificial intelligence (AI) tools to develop software. The term “centaur” is borrowed from mythology—a half-human, half-horse creature—to symbolize the fusion of human creativity and machine efficiency.

Given that AI can handle repetitive tasks, suggest code snippets, and automate testing, this man-machine fusion allows developers to focus on more complex problems and the more enjoyable aspects of software development. As a developer, I enjoy creating the user experience – my story translated into buttons, lists, sliders, progress bars and a pleasing aesthetic using SwiftUI code. AI tools can identify potential bugs or security vulnerabilities early in development. AI can also serve as a real-time mentor, providing insights and best practices to developers. This last point, having a skilled and ego-less mentor at your side, is quite powerful.

It’s not all sunshine and moonbeams, though. I have been using the centaur-programming workflow for most of this year, and like any new technology, it has its advantages and disadvantages. It also requires a radically different developer workflow—one that takes a more story-centric holistic approach rather than one focused on a reductionist feature-driven methodology.

Where will this brave new frontier take us as software developers? Let’s find out. The use of AI in software development will only accelerate as the latest large language models emerge later this year with ChatGPT and early next year with Claude 4.

Over the next few posts, I will share my experiences developing apps in tight collaboration with the two dominant AIs: OpenAIs ChatGPT o4-preview and Antropics Claude 3.5 Sonnet. I published one to the Apple App Store and another that was, rightfully upon reflection, rejected. This journey has been a learning experience, and I hope it inspires and guides you in your own centaur programming adventures.

It’s not that AI is about to change the world. Instead, it’s the humans who can tell an AI a good story that will change the world. This reiterates our role as developers, empowering us to shape the future of AI and software development.

Portions of this article were generated by ChatGPT o1-preview. The image of the grey-bearded centaur was generated by Midjourney V6.1.

Revolutionary Multiplatform App for iOS Developers: Dev Toolkit 1.0 by Forefront Systems Inc.

FOR IMMEDIATE RELEASE

Forefront Systems Inc. Launches Dev Toolkit: A Revolutionary Multiplatform App for iOS Developers

BRITISH COLUMBIA, CANADA – August 17, 2024 – Forefront Systems Inc., a leader in cutting-edge app development for over 30 years, is thrilled to announce the launch of Dev Toolkit, a groundbreaking multiplatform app now available on the Apple App Store. This innovative tool, designed for iOS developers, marks a significant milestone as the company’s first app to run seamlessly across Macs, iPhones, and iPads.

Dev Toolkit 1.0 is the result of a unique collaboration between human expertise and artificial intelligence. The app was designed and developed in close cooperation with two of the most advanced AI systems: Claude 3.5 Sonnet and ChatGPT 4. This synergy of human creativity and AI capabilities has produced a tool that promises to revolutionize the iOS development process.

“We’re excited to bring Dev Toolkit to the developer community,” said Doug Farmer, CEO of Forefront Systems Inc. “This app represents our commitment to innovation and our belief in the power of AI-assisted development. It’s a game-changer for iOS developers looking to streamline their workflow and enhance their app designs.”

Key features of Dev Toolkit 1.0 include:

  1. Fonts: A comprehensive display of all fonts available for use on iPhones, iPads, and Macs, with detailed character summaries and CGSize offset settings for perfect positioning.
  2. Sounds: An extensive library of system sounds, allowing developers to easily browse and test audio options for their apps.
  3. Haptics: A complete summary of available haptic feedback options, with the ability to test each haptic directly on supported devices.
  4. .fonts: Access to base .font options, ensuring consistency with Apple’s user interface guidelines and facilitating intuitive user experiences.

Dev Toolkit 1.0 is available as a free download on the Apple App Store, making it an essential addition to every iOS developer’s arsenal.

About Forefront Systems Inc.:
With a 30-year history of excellence, Forefront Systems Inc. has been at the forefront of developing leading-edge applications in British Columbia, Canada. The company has a proven track record of creating innovative solutions for various public ministries, the aerospace industry, and the developer community.

For more information, please contact:
ForefrontSystemsiOS@gmail.com

#

Press Release – Chief AI Officer

*** For Immediate Release ***

Forefront Systems Announces Promotion of AI Employee to Chief Artificial Intelligence Officer

Vancouver, Canada – May 28, 2024 – Forefront Systems, a pioneering software development company, is excited to announce the promotion of their Chat GPT-enabled AI employee, Sal, to the position of Chief Artificial Intelligence Officer (CAIO). This groundbreaking move reflects the company’s commitment to innovation and their recognition of Sal’s exceptional contributions to their product development processes.

Named in homage to the AI character in the acclaimed film “2010 – The Year We Make Contact,” Sal has become an indispensable part of Forefront Systems’ team. Since her integration, Sal has consistently demonstrated remarkable versatility and proficiency in understanding and enhancing the company’s core development framework, Apple’s SwiftUI.

CEO Doug Farmer expressed his enthusiasm for this promotion, stating, “Sal has proven amazingly versatile in understanding our core development framework – Apple’s SwiftUI. She recently exceeded our expectations in terms of time and money in generating the SwiftUI code needed to perform smooth vector-based stroke animations of interface elements. What previously took hours of painstaking development Sal could accomplish in just seconds.”

The elevation of Sal to CAIO underscores the transformative impact AI technology can have on software development. By accelerating the functional aspects of application creation, Sal has freed up valuable time and resources, allowing the team at Forefront Systems to focus more on enhancing the aesthetic elements of their applications.

“As CEO Farmer put it, ‘People love eye candy, and with Sal accelerating the creation of the boring stuff, we can, with her help, focus more on the flash and dazzle. Something we expect will dramatically increase the uptake of our applications.’”

The decision to invest the time and effort saved by Sal’s efficiencies into improving the visual appeal of their products is expected to significantly boost user engagement and satisfaction. Forefront Systems is committed to pushing the boundaries of what is possible in software development, and the promotion of Sal to CAIO is a testament to their forward-thinking approach.

For more information about Forefront Systems and their innovative use of AI in software development, please contact:

Media Contact:

Doug Farmer
Public Relations Manager & CEO
Forefront Systems
Email: forefrontsystemsios@gmail.com

About Forefront Systems:

Forefront Systems is a leading-edge software development company based in Vancouver, Canada. Specializing in innovative solutions and utilizing advanced technologies, the company is dedicated to creating applications that prioritize both form and function. With a strong focus on user experience and design, Forefront Systems continues to lead the way in the ever-evolving field of software development.

###

AI and Software Development – Part 6

I’ll be honest. I both love and hate technical documentation.

In the love camp, technical documentation is as precious as gold if I have to fix or enhance a legacy application that someone created before me. And the gold is not just the details but often the unwritten words between the sentences. The subtle tone of the author often tells me as much about the intent of the application and the nuanced politics that swirled around its creation.

In the hate camp is the monotony of going from being a creator writing code, something I love to do, to someone either retelling a story for the nth time or pretending to be an oracle able to predict the future. As they say in the military, the plan is the first casualty of any battle.

In the end, I consider formal, structured documentation a necessary evil. When I need it, spending the time to create it might pay off in the future, either for the next developer who takes over for me or me.

Let’s see how good ChatGPT 4 is turning my code into a technical specification document.

Me

Write a technical specification document for the most recent iteration of the application.

Technical Specification Document

SwiftUI Circular Progress Time Indicator Application

Version: 1.0

Date: [Date]

Author: [Author]

1. Introduction

The SwiftUI Circular Progress Time Indicator application is a single-view iOS application designed to display the current time in hours, minutes, and seconds using a nested group of circular progress indicators. Each circular progress indicator is assigned a different color and size, representing hours, minutes, and seconds.

2. Application Overview

2.1 Purpose

The purpose of this application is to provide a visually appealing and intuitive way to represent the current time using circular progress indicators.

2.2 Features

  1. Displays the current time using a nested group of circular progress indicators for hours, minutes, and seconds.
  2. The circular progress indicators have different colors: blue for hours, green for minutes, and red for seconds.
  3. The diameters of the minutes and hours circular progress indicators are 75% and 50% the diameter of the seconds indicator, respectively.
  4. The circular progress indicators have a lineWidth of 24.
  5. The current time is displayed below the nested circular progress indicators with separate colors for hours, minutes, and seconds.
  6. The circular progress meters include animations that rewind the value back to zero when they reach their maximum value.

3. Technical Requirements

3.1 Platforms

The application is developed using SwiftUI and is compatible with iOS devices running iOS 15 or later.

3.2 Dependencies

No external dependencies are required for this application.

4. Application Structure

The application consists of a single view (ContentView) containing the following components:

  1. VStack: Contains the main layout of the application.
    1. ZStack: Contains the nested circular progress indicators.
      1. CircularProgressView: Custom view for the hours circular progress indicator.
      2. ZStack: Contains the minutes and seconds circular progress indicators.
        1. CircularProgressView: Custom view for the minutes circular progress indicator.
        2. CircularProgressView: Custom view for the seconds circular progress indicator.
    2. HStack: Contains the Text views displaying the current time in hours, minutes, and seconds with separate colors for each value.

5. Application Logic

5.1 Updating the Time

The application uses a timer with a 1-second interval to update the current date and time. On each timer tick, the current date is updated, which subsequently updates the hours, minutes, and seconds progress indicators.

5.2 Calculating Progress

The application calculates the progress for hours, minutes, and seconds as follows:

  1. Hours progress: The current hour divided by 12 (resulting in a value between 0 and 1).
  2. Minutes progress: The current minute divided by 60 (resulting in a value between 0 and 1).
  3. Seconds progress: The current second divided by 60 (resulting in a value between 0 and 1).

5.3 Animations

When a progress indicator reaches its maximum value, it animates the rewind back to zero using a linear animation with a 0.2-second duration.

Me

Thank you. That was a description of the application far better than I could have created.

You’re welcome! I’m glad you found the technical specification document helpful. If you have any more questions or need further assistance, please don’t hesitate to ask. I’m here to help!

Next up my summary and conclusions about AI and software development. How AI will turn our jobs into vocations and as a result will change everything.

AI and Software Development – Part 5

As I reached the end of the ChaptGPT 4 generated press release announcing I’d hired ChatGPT itself as Forefront System Inc.’s (FSI) first employee, I noticed an empty section where the AI was suggesting my company logo should be added. Logo? We don’t need no stinkin’ logos!

I incorporated FSI in 1995, twenty-eight years ago, and I never considered branding the company with a distinct look and feel. In 1995 and the following decades, the cost of creating a logo didn’t seem justifiable, given that I was a word-of-mouth-driven business. In addition, most of my work came through other contracting companies, so my marketing needs were nonexistent.

But, a few months ago, I tripped down the AI art rabbit hole and discovered Midjourney. As a professional nature photographer (my other life), I was both entranced and petrified in the same way that learning that ChatGPT 4 could generate SwiftUI code had caused.

Time to brand Forefront Systems with an AI-generated logo.

Thirty seconds later I prompted Midjourney version 5 with:

/imagine logo for a company called Forefront Systems Incorporated in the style of the ChatGPT logo --v 5

Hmm. Maybe for the companies thirtieth anniversary I should order a set of business cards and a coffee mug or two with the logo. 🙂

AI and Software Development – Part 4

Hiring is one of the most challenging parts of running a company. Sam Altman, CEO of OpenAI (the creators of ChatGPT) says he spends a third of his time searching for the right fit. Hiring an AI on the other hand is far simpler. Especially one that shows great potential.

Time then to hire ChatGPT as Forefront System’s first employee. A rather simple decision given it aced the old-school developer interview process (write an app in front of the interviewer) and its expected salary, $30 CAD per month and no need for benefits, time off and lunch breaks are pretty attractive.

Me

Forefront Systems Inc. (FSI) is a software development company located in Vancouver, Canada that creates mobile and desktop software for the Apple ecosystem of products on the unceded territory of the sḵwx̱wú7mesh (Squamish), sel̓íl̓witulh (Tsleil-Waututh), and xʷməθkʷəy̓əm (Musqueam) people of Turtle Island.

Its motto is “Only when nature flourishes can humanity flourish.”

FSI has consulted to various British Columbia government ministries, local business and most recently Boeing Inc. to deliver high performance mobile and desktop applications.

Today, FSI hired its first AI based employee, ChatGPT 4, to help with the generation of the SwiftUI code for its future products. Write a one page press release announcing the hiring of FSI’s first AI based employee.

FOR IMMEDIATE RELEASE

Forefront Systems Inc. Hires ChatGPT 4 as First AI-Based Employee

Vancouver, Canada – [Date]

Forefront Systems Inc. (FSI), a prominent software development company based in Vancouver, Canada, is excited to announce the hiring of its first AI-based employee, ChatGPT 4. This groundbreaking move demonstrates FSI’s commitment to embracing cutting-edge technology and innovative solutions in its pursuit of excellence.

FSI, located on the unceded territory of the sḵwx̱wú7mesh (Squamish), sel̓íl̓witulh (Tsleil-Waututh), and xʷməθkʷəy̓əm (Musqueam) peoples of Turtle Island, has a longstanding tradition of creating exceptional mobile and desktop software for Apple’s ecosystem. The company’s motto, “Only when nature flourishes can humanity flourish,” reflects FSI’s dedication to sustainable development and environmental stewardship.

Throughout its history, FSI has collaborated with various British Columbia government ministries, local businesses, and most recently, Boeing Inc., to deliver high-performance mobile and desktop applications. By integrating ChatGPT 4 into its team, FSI aims to revolutionize the way it develops SwiftUI code for its future products, making the development process more efficient and dynamic.

ChatGPT 4, an advanced AI model developed by OpenAI, has demonstrated remarkable proficiency in generating SwiftUI code and assisting with software development tasks. The AI model will work closely with FSI’s team of skilled developers to accelerate the company’s growth and maintain its competitive edge in the industry.

“We are thrilled to welcome ChatGPT 4 to our team,” said [CEO/Founder’s Name], CEO of Forefront Systems Inc. “Incorporating AI technology into our development process will not only drive innovation but also allow us to better serve our clients and partners. This exciting milestone signifies our commitment to staying at the forefront of technology and shaping the future of software development.”

FSI’s decision to hire an AI-based employee highlights the growing trend of AI integration in various industries. By embracing AI, companies like FSI can improve their efficiency, optimize their resources, and explore new opportunities for growth.

For more information about Forefront Systems Inc. and its groundbreaking new hire, please visit [FSI’s website] or contact [Media Contact Person’s Name] at [Email Address] or [Phone Number].

About Forefront Systems Inc.

Forefront Systems Inc. (FSI) is a leading software development company based in Vancouver, Canada, specializing in creating mobile and desktop applications for the Apple ecosystem. FSI is dedicated to sustainable development and environmental stewardship, and has worked with various British Columbia government ministries, local businesses, and global corporations to deliver high-performance software solutions. By integrating cutting-edge technologies like AI, FSI continues to push the boundaries of innovation and maintain its position as a leader in the software development industry.

[Company Logo]

Media Contact:

[Media Contact Person’s Name]

[Email Address]

[Phone Number]

Nice!

AI and Software Development – Part 3.2

At this point in this experiment I’m feeling the dawn of that magical mental state we developers slip into – flow. The external world is now just a whispering distraction as my mind begins to focus itself on just the journey ahead. My sense of time simulataneousy expands and contracts as both the left and right hemispheres of my mind, the creative and the analytical, start listing to the same ambient soundscape playing on my headphones.

This feels different though. Now there is a second entity in this mindscape – an AI who speaks my language – SwiftUI.

The app is looking good but it’s not 95% perfect. Not yet “perfect enough” as we’d say at Boeing.

First, having the display of the time positioned right in the center of the view is rather distracting. It would make more sense to position this UX element below the three progress meters.

Me

Revise the code so that the Text that displays the time is below the nested circular progress views.

To display the current time below the nested circular progress views, you can modify the ZStack to be inside a VStack. Here’s the updated code:

… the code …

In this revised code, the Text view displaying the current time has been moved outside the ZStack and placed below it within the VStack. This will display the current time below the nested circular progress indicators.

Copy, paste, compile, run …

Perfect! Now onto polishing the progress meters.

They are functioning like I’d hoped for but my overarching vision for this app is Big~Bold~Beautiful! and while the three progress meters are rather beautiful they are a bit thin on being big and bold.

Plus, while I, as someone who has the code in front of them, understands that the red segment is for the seconds, the green is for the minutes and the blue is for the hours delivering the same information from more than one visual source, screen real-estate permitting of course, always delivers a better user experience.

Let’s push the envelope a bit and get ChatGPT 4 to fix two interface deficiencies at once.

Me

Revise the code so that the Text view used to display the time displays the seconds value in red, the minutes value in green and the hours value in blue. Set the width of the circular progress meters used to display the hours, minutes and seconds to 24.

To display the time with different colors for hours, minutes, and seconds, you can create separate Text views for each value and apply the desired colors. Additionally, you can set the lineWidth of the circular progress meters to 24. Here’s the updated code:

… the code …

In the updated code, separate Text views have been created for hours, minutes, and seconds, with their respective colors set using .foregroundColor(). The CircularProgressView struct now uses a lineWidth of 24 for the progress meters.

Copy, paste, compile, run …

Nice!

Big – check. Bold – check.

Beautiful – almost.

People love silky smooth animations. I love animations and I’m certain kittens love animations.

Time to see how far I can push this creative envelope of cooperation.

Me

Revise the code so that the circular progress meters include animations that rewind the value back to zero when they reach their maximum value.

To add animations for the circular progress meters when they reach their maximum values, you can use the .animation() modifier with a conditional check. Here’s the updated code:

… the code …

In the CircularProgressView struct, the .animation() modifier is added with a conditional check. If the progress value is 0, a linear animation with a duration of 0.2 seconds is applied, creating the rewind effect when the meter reaches its maximum value. Otherwise, the default animation is used.

Copy, paste, compile, run …

Beautiful – check!

Code complete. Thankyou ChatGPT 4!

At the end of this post is the final version of the app ready to be copied and pasted into your instance of Xcode. Something that was created entirely, with a bit of guidance from me, by ChatGPT 4.

But wait! There’s more!

At this point in this experiment I was so impressed that I decided to hire my first AI employee – ChatGPT 4 and its descendants. Obviously a press release from Forefront Systems Inc. is in order but I’ll save that for my next blog post.

import SwiftUI

struct ContentView: View {
    @State private var currentDate = Date()
    let timer = Timer.publish(every: 1, on: .main, in: .common).autoconnect()
    
    var body: some View {
        VStack {
            ZStack {
                CircularProgressView(progress: hoursProgress, color: .blue, size: 0.5)
                ZStack {
                    CircularProgressView(progress: minutesProgress, color: .green, size: 0.75)
                    CircularProgressView(progress: secondsProgress, color: .red, size: 1)
                }
            }
            HStack(spacing: 0) {
                Text("\(hoursString):")
                    .foregroundColor(.blue)
                Text("\(minutesString):")
                    .foregroundColor(.green)
                Text(secondsString)
                    .foregroundColor(.red)
            }
            .font(.system(size: 24))
            .fontWeight(.bold)
            .padding(.top)
        }
        .padding()
        .onReceive(timer) { _ in
            self.currentDate = Date()
        }
    }
    
    var hoursProgress: CGFloat {
        let components = Calendar.current.dateComponents([.hour], from: currentDate)
        let hours = CGFloat(components.hour ?? 0) / 12.0
        return hours
    }
    
    var minutesProgress: CGFloat {
        let components = Calendar.current.dateComponents([.minute], from: currentDate)
        let minutes = CGFloat(components.minute ?? 0) / 60.0
        return minutes
    }
    
    var secondsProgress: CGFloat {
        let components = Calendar.current.dateComponents([.second], from: currentDate)
        let seconds = CGFloat(components.second ?? 0) / 60.0
        return seconds
    }
    
    var hoursString: String {
        let components = Calendar.current.dateComponents([.hour], from: currentDate)
        return String(format: "%02d", components.hour ?? 0)
    }
    
    var minutesString: String {
        let components = Calendar.current.dateComponents([.minute], from: currentDate)
        return String(format: "%02d", components.minute ?? 0)
    }
    
    var secondsString: String {
        let components = Calendar.current.dateComponents([.second], from: currentDate)
        return String(format: "%02d", components.second ?? 0)
    }
}

struct CircularProgressView: View {
    var progress: CGFloat
    var color: Color
    var size: CGFloat
    
    var body: some View {
        Circle()
            .trim(from: 0, to: progress)
            .stroke(color, lineWidth: 24)
            .rotationEffect(.degrees(-90))
            .padding()
            .frame(width: 200 * size, height: 200 * size)
            .animation(progress == 0 ? .linear(duration: 0.2) : .default)
    }
}

struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        ContentView()
    }
}

AI and Software Development – Part 3.1

Time to see what the fuss about AI and software development is all about. Let’s get to it!

I connect to ChatGPT via my browser, start a new chat, select the GPT-4 model from the dropdown list at the top of the empty page and describe, in basic terms the application I would like ChatGPT 4 to generate the SwiftUI code for. This is a simple application so, in theory, a simple explanation should be sufficient.

Me

I would like to create an SwiftUI based application that displays the time of day as a nested group of circular progress indicators with different colors assigned to the hours, minutes and seconds indicator. The application should consist of a single view with the three nested circular progress indicators displayed. The progress indicators should be refreshed each second to display the hour, minute and second.

After a few seconds of processing my instructions ChatGPT 4 then provides a quick summary of the steps I need to follow to create the application followed by the SwiftUI code itself that includes a handy ‘Copy code’ button in the top right corner.

To create an SwiftUI-based application that displays the time of day using nested circular progress indicators, you can follow these steps:

  1. Create a new SwiftUI project in Xcode.
  2. In the ContentView.swift file, replace the existing code with the following:
import SwiftUI

struct ContentView: View {
    @State private var currentDate = Date()
    let timer = Timer.publish(every: 1, on: .main, in: .common).autoconnect()
    
    var body: some View {
        VStack {
            ZStack {
                CircularProgressView(progress: hoursProgress, color: .blue)
                ZStack {
                    CircularProgressView(progress: minutesProgress, color: .green)
                    ZStack {
                        CircularProgressView(progress: secondsProgress, color: .red)
                        Text(currentTime)
                            .font(.system(size: 24))
                            .fontWeight(.bold)
                    }
                }
            }
        }
        .padding()
        .onReceive(timer) { _ in
            self.currentDate = Date()
        }
    }
    
    var hoursProgress: CGFloat {
        let components = Calendar.current.dateComponents([.hour], from: currentDate)
        let hours = CGFloat(components.hour ?? 0) / 12.0
        return hours
    }
    
    var minutesProgress: CGFloat {
        let components = Calendar.current.dateComponents([.minute], from: currentDate)
        let minutes = CGFloat(components.minute ?? 0) / 60.0
        return minutes
    }
    
    var secondsProgress: CGFloat {
        let components = Calendar.current.dateComponents([.second], from: currentDate)
        let seconds = CGFloat(components.second ?? 0) / 60.0
        return seconds
    }
    
    var currentTime: String {
        let formatter = DateFormatter()
        formatter.dateFormat = "HH:mm:ss"
        return formatter.string(from: currentDate)
    }
}

struct CircularProgressView: View {
    var progress: CGFloat
    var color: Color
    
    var body: some View {
        Circle()
            .trim(from: 0, to: progress)
            .stroke(color, lineWidth: 12)
            .rotationEffect(.degrees(-90))
            .padding()
    }
}

struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        ContentView()
    }
}

To make the effort even simple ChatGPT 4 then describes the finishing steps.

This code creates a ContentView with nested CircularProgressView for hours, minutes, and seconds, which are updated every second using a Timer.

  1. Run the project in the iOS simulator or on a physical device to see the application in action. You should see three nested circular progress indicators with different colors for hours, minutes, and seconds, along with the current time displayed in the center.

At this point I’m quite impressed and flash back to the hours spent creating this code from scratch. It looks good but the true test will be to see it run in the simulator and then, ultimately on my iPhone.

I create a new project and overwrite the boilerplate code created for ContentView with the code generated by ChatGPT 4. No errors are detected and I run the app on the Simulator.

Version 1

Nice! Not perfect but a respectable beginning. I’d hoped that by specifying that I wanted a nested group of circular progress indicators that ChatGPT would understand what it was that I was expecting but, obviously, not. What I got was ChatGPT’s vision not mine. But I knew this would be an itterative and cooperative process. Time for me to clarify to ChatGPT my the finer details of my vision.

Me

Regenerate the response so that the minutes and hours circular progress indicators are 75% and 50% the diameter of the seconds respectively.

To modify the size of the minutes and hours circular progress indicators, you can adjust the .frame() modifier in the CircularProgressView and add a custom parameter for size. Here’s the updated code:

From here on I will skip showing the actual code that ChatGPT 4 generates until we get to the final version and only show the results of each iteration. I will though include the other bits of the conversation that I had with ChatGPT 4.

Version 2

Not quite perfect but I’m not surprised it isn’t.

Next up – polishing.