Skip to content

Productive Project with a Couple of Caveats #2

Description

@Count-Mela

I produced a basic functional calculator with this app in Xcode 26; but it is very simple and had some common issues in the original prototype (draft). I'm not certain if the original developer introduced this issue intentionally; but, If I were the original developer then I would have at least added a comment that lets the audience know that the calculate function renders a "Calculator/ViewController.swift:75: Fatal error: Unexpectedly found nil while unwrapping an Optional value"

func calculate() -> Double{
        let previousNumber = Double(previousNumberText)! _<- o "Fatal error: Unexpectedly found nil while unwrapping an Optional value"_ 
        let currentNumber = Double(currentNumberText)!
        previousNumberText = ""
        currentNumberText = ""

This is a common problem in Xcode development and can be utilized by new developers and students to hone their developer skills and begin researching developer issues; but, I really think that the author should have indicated that this would create an error that prevents the calculator from performing the basic operations; and that users will have to develop their own solutions to resolve these issues.
Also the presentation of this project does not correctly provide a "clearAll" function, e.g., func clearAll or a NaN operation when a user attempts to divide by "0."
This is still a valuable exercise and introduction to Xcode development procedures in Swift Storybook (but I generally prefer the Objective-C/Swift without Storybook DUI); the issues just seem short sided and should at least inform the audiences that they will encounter issues and need to research/handle these issues to produce a calculator that is fully functional.

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions