

SwiftUI
- Should the business logic go in the model or in the view model?
cross-posted from: https://programming.dev/post/31627972
> The internet keeps telling me that they go in the model, but some developers tell me that it goes in the view model > > > Model (Data / Networking / Algorithms) objects represent special knowledge and expertise. They hold an application’s data and define the logic that manipulates that data.\ > > <https://developer.apple.com/forums/thread/699003> > > > > > Therefore, the model can be thought of as representing the app's domain model, which usually includes a data model along with business and validation logic.\ > <https://learn.microsoft.com/en-us/dotnet/architecture/maui/mvvm> > > > > > Model: Contains the data or the business logic. Any changes in data are communicated to the ViewModel.\ > <https://medium.com/@dilipp817/understanding-mvvm-architecture-a-beginners-guide-to-model-view-viewmodel-8fb05c285710> > > > > The Model's purpose is to represent (or model) your business domain. Therefore, business logic by definition goes in the Model, not the ViewModel.<https://developer.apple.com/forums/thread/699003>\ > <https://stackoverflow.com/questions/37671866/should-i-implement-business-logic-on-a-model-or-a-viewmodel> > > > Even though the vast majority of business logic is present in the data layer, the UI layer can also contain business logic. This can be the case when combining data from multiple repositories to create the screen UI state, or when a particular type of data doesn't require a data layer.\ > > > > ViewModel is the right place to handle business logic in the UI layer. The ViewModel is also in charge of handling events and delegating them to other layers of the hierarchy when business logic needs to be applied to modify application data.\ > > <https://developer.android.com/topic/libraries/architecture/viewmodel>
- What are you working on this month? (November 2023)
Any SwiftUI related projects/packages you’re working on?
Something you’d like to share or perhaps need help with?
Share it here!
- What are you working on this month? (October 2023)
Any SwiftUI related projects/packages you’re working on?
Something you’d like to share or perhaps need help with?
Share it here!
---
Aside:
Sorry for being late on this. Personal and professional developments had me taking a step back these past 30 days. Will be back to keeping things up to date moving forward.
- What's everyone thoughts on a monthly hack-a-thon around a community voted topic?
So 3 things,
-
A post will be created to poll the topics from the community on the theme/topic. Could be things like a photo album gallery or maybe something creative such as a piano roll that plays midi notes.
-
At the top of the month, everyone has 2-3 weeks to build their project out. These have to be open-source. And the last week of the month, we all vote on the top picks and a pinned post will have links to the repos of all the contestants whom participated + the top 3 winners.
-
Everyone is welcome to help each-other out, form teams, or simply handle their projects solo. BUT, you cannot use past projects in your solutions. Meaning, you can't simply integrate verbatim code from an existing repo or an entire solution that you previously created without good reason at least. Definitely, partial re-use is allowed.
----
I find that this could be an interesting opportunity to simply allow people share their work, introduce interesting solutions or simply learn from others if they are starting to learn SwiftUI.
-
- SwiftUI + Browser Apps/WASMgithub.com GitHub - TokamakUI/Tokamak: SwiftUI-compatible framework for building browser apps with WebAssembly and native apps for other platforms
SwiftUI-compatible framework for building browser apps with WebAssembly and native apps for other platforms - TokamakUI/Tokamak
Found this to be a really cool project for those in web development that were thinking about learning SwiftUI. And SwiftUI devs who want to attempt browser based solutions.
- What are you working on this month? (September 2023)
Any SwiftUI related projects/packages you’re working on?
Something you’d like to share or perhaps need help with?
Share it here!
- Intro to Transactionsjuniperphoton.substack.com Pro to SwiftUI: Transaction and the propagation
This article is part of the "Pro to SwiftUI" series, mainly sharing some insights, experiences, and pitfalls recorded after developing a few apps using SwiftUI.
- Rendering Video and HLSStreamsgithub.com GitHub - kingslay/KSPlayer: A video player for iOS、macOS、tvOS、visionOS , based on AVPlayer and FFmpeg, support the horizontal, vertical screen. support adjust volume, brightness and seek by slide, SwiftUI, support subtitles.
A video player for iOS、macOS、tvOS、visionOS , based on AVPlayer and FFmpeg, support the horizontal, vertical screen. support adjust volume, brightness and seek by slide, SwiftUI, support subtitles. ...
This project is really amazing for rendering HLSStreams and video in general. Especially on SwiftUI.
It exposes the metal textures prior to rendering which you can also tweak if you wanted to add some layer of effects in between.
And honestly overall having the ability to use ffmpeg easily as a swift package is a huge plus.
This is their FFmpeg kit: https://github.com/kingslay/FFmpegKit/tree/main
Here’s the SwiftUI implementation example: https://github.com/kingslay/KSPlayer/tree/develop/Demo/SwiftUI
- What’s everyone’s preferred method of handling navigation stacks?
Curious to start a discussion around the usage of
NavigationView
or the newNavigationStack
in a complex app structure.How people have implemented these in their own Apps or if they even use these, or have they come up with their own custom solutions?
I’ll start:
I experimented with a custom solution (not using navigationview or stack at all) using ZStacks on the topmost level of the application essentially. I’ve seen significant improvement in performance and cleaner code execution allowing me to route views inside nested sub views simply referencing an
EnvironmentValue
. But, the downside is losing the out of the box, didAppear and didDissappear lifecycle events.I see NavigationStack is following suit with storing a stack of paths to route. But, sadly doesn’t support iOS 15. Using UIKit’s navigation controller is kind of a pain when wanting to support all 3 platforms too.
But, I wonder if others have done some analysis on trade offs regarding Navigation. Since it’s kind of the cornerstone of an Application as a whole.
- www.avanderlee.com @AppStorage explained and replicated for a better alternative
The @AppStorage property wrapper allows reading and writing user defaults easily, while monitoring changes to redraw SwiftUI Views.
- Stanford CS193p - Developing Applications for iOS (2023)
Stanford finally uploaded their latest recording from Spring 2023. It's an updated version of their excellent course on SwiftUI development.
- [META] Head mod and other mods wanted
I've created this community because I was looking for one to participate in and it didn't exist yet.
Since then I've come to the realization that I can't commit the time that's necessary to make this into a successful community.
That's why I'm looking for someone who would like to take over and to whom I can transfer the community.
All that I ask is that you give it your best shot.
If you're interested please reply to this post.
- You can now have more than 10 child views
Xcode 15b3 allows as many child views in SwiftUI as you need, with no need to use Group!
Gone are the days of forgetting how many views you’ve used and then getting an error at compile time because you used 11 child views 😂
- Convert UIKit to SwiftUI iOS App Development | Live Coding | Building In Public | Mikaela Caron
YouTube Video
Click to view this content.
- [Lemmit] SwiftUI Weekly - Issue #149weekly.swiftwithmajid.com SwiftUI Weekly - Issue #149
The curated collection of links about SwiftUI. Delivered every Monday.
cross-posted from: https://lemmit.online/post/79846
> ##### This is an automated archive made by the Lemmit Bot. > The original was posted on /r/swiftui by /u/majid8 on 2023-07-03 15:07:59+00:00. >
- What are you working on this month? (July 2023)
Any SwiftUI related projects you're working on?
Something you'd like to share or perhaps need help with?
Share it here!