|
I took some liberties and have 0 to 20 cups of coffee. 0 cups does not use the ML Model. I also have inflections on 0 cups, 1 cup and 2 cups...
|
|
Taking liberties with your code is a GREAT way to experiment with the lesson's concepts. Testing out assumptions, playing with Swift built-in function options, and changing the interface is a key to learning more about the language. Here's a comment on function naming. Try to go out of your way to name functions with descriptions that make it crystal clear to future you™ what your function does. What does this function do?
If I were to paste this into my solution, the name is confusing. Then when I run this code, SURPRISE! It neither shortens the date, nor does it convert it! Instead, the result is the time extracted from the date your programmers provides! (TBH, is does convert the results to a String.) ConsiderSo please consider the following.
Keep coding! |
|
You added this
however Also do NOT leave the title with
Why Let complier do the heavy lifting |
BUILD THE ULTIMATE PORTFOLIO APP Most Swift tutorials help you solve one specific problem, but in my Ultimate Portfolio App series I show you how to get all the best practices into a single app: architecture, testing, performance, accessibility, localization, project organization, and so much more, all while building a SwiftUI app that works on iOS, macOS and watchOS.
Sponsor Hacking with Swift and reach the world's largest Swift community!
You need to create an account or log in to reply.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.