A showcase of Swift, SwiftUI, and iOS goodies.
Feel free to request features or suggestions for improvements.
Check for device jail-broken status.
Example for showing local notifications.
Example of common accessibility modifiers.
![]() |
![]() |
![]() |
|---|---|---|
![]() |
![]() |
![]() |
A simple example to demonstrate separate views for iPhone and iPad. Users will see the bottom nav on iPhone and a Sidebar on iPad.
![]() |
![]() |
|---|
A cool "Android Toast" like implementation for SwiftUI.
Examples are capturing images, recording video, and selecting media from the library.
A custom Toggle component with inside label support.
Ongoing...
SwiftUI modifier for UIAlertController. This is created to be able to change the Alert button colors.
Add fonts to the project, add the fonts name to the plist file. Finally, use fontStyle(size:weight:) to set fonts.
Total 3 playgrounds related to date formatting. Inspired by NSDateFormatter.com.
![]() |
![]() |
![]() |
|---|
A ready-to-use wrapper for SwiftUI-Shimmer.
![]() |
![]() |
![]() |
|---|
A collection of animation-related SwiftUI features.
A beginner example for Maps in SwiftUI.
map-example.mp4
Check out the "News" module to get an example of how to run a UI test using mock data.
Check Playgrounds directory for the books.
1. GCD and Structured Concurrency Model: A quick guide about the GCD (DispatchQueue etc.) and Structured Concurrency Model (Task, actor, Sendable etc.)
- Example to create a preview with mock Models and ViewModels (
ObservableObject). (See Media Capture & Select Example) - Macro example (see
packages/URLMacrodirectory) - This project is using Tuist. Current
Tuistimplementation has the following examples:- Quick module add using
Modulemodel - Custom Schema
- Custom
xcconfig - Custom Build Config
- Custom InfoPlist
- Quick module add using
NavController: A ready-to-use navigation wrapper on top ofNavigationStack.- Basic example for
URLSession - Basic example for
Alamofire - Basic example for
@AppStorage - Basic example for
Realm
This project is using Tuist. To run the project we need some initial setup.
Step 1: Install mise
We need mise to install Tuist and for maintaining project based Tuist versioning.
Install mise CLI:
# Install CLI
$ curl https://mise.run | sh
# Check mise version
$ ~/.local/bin/mise --version
mise xxxx.x.x
# Add mise to Zsh configuration file (`.zshrc`) for auto activate mise
$ echo 'eval "$(~/.local/bin/mise activate zsh)"' >> ~/.zshrcFinally, restart your shell session to use mise.
Install Tuist using the following command:
mise install tuistgit clone git@github.com:ImaginativeShohag/Why-Not-SwiftUI.git
cd Why-Not-SwiftUIWe need to fetch the app dependencies. So use the following command to install the dependencies from Package.resolved file using Tuist.
tuist installFinally, generate and open the project using the following command:
tuist generateThis will generate the project file and open the project in Xcode.
- As we are using
Tuistto manage our Xcode project, use the following command to open the Tuist manifest files in Xcode for editing:
tuist edit-
We have to run the
tuist installevery time we change any dependency of our project. -
To upgrade dependency versions, use
tuist install --updatecommand. -
Always use
tuist generateto open the project. -
After changing branch we also need to run the
tuist generatecommand to generate project files. -
Please don't use Xcode Source Control. (Issue)
Please see the Tuist documentation for details.
tuist test 'WhyNotSwiftUI Development' \
--skip-test-targets NetworkKitTests/NetworkProdTestsRoot: Root directoryConfigurationFiles: Configuration filesCoreData: Core Data modelsEntitlements: EntitlementsTargets: Targets/ModulesModuleX: An example target/moduleResources: Resource ofModuleXSources: Source codes ofModuleXModels: All models forModuleX- Note: Keep models screen/sheet name wise.
UI: All the UI files forModuleX. It also containsViewModels.Components: Common UI components that are shared in multiple screensScreens: All screens, sheets etc.XYZ: UI files for screen/sheetXYZComponents: Common UI components for screen/sheetXYZABCView.swift: Example component file
XYZScreen.swift: Example screen/sheet UI fileXYZViewModel.swift: Example view model file
ViewModels: CommonViewModels forModuleX.
Tests: Unit test targetResources: Resource ofTestsXYZTests.swift: Example unit test file
UITests: UI test targetResources: Resource ofUITestsXYZUITests.swift: Example UI test file
ModuleYModuleZ- ...
Tuist: Tuist configuration files
Note: Let's assume our target name is Core.
/// Get current targets `Bundle` instance.
let bundle = Bundle.module
/// Get a specific targets `Bundle` instance.
let bundle = CoreResources.bundle
// Equivalent old way:
let bundle = Bundle(identifier: "org.imaginativeworld.Why-Not-SwiftUI.Core")Note: Let's assume our target name is Core.
// Old way
let color: Color = Color("example-color")
// New way
let color: Color = CoreAsset.exampleColor.swiftUIColor
// Old way
let image: UIImage = UIImage("example-image")! // The asset must be in the current target :(
// New way
let image: UIImage = CoreAsset.exampleImage.image // Access from any target :)- MetricKit crash report example (WIP)
- Full app custom font
- Custom Sidebar: Finalize it (WIP)
- Custom Build variant
- Add documentation to the extensions
- Home list multiple accent color
- Use system font styles
- CMS Module
- System UI Components Collection
- SF Symbol animation ((How to animate SF Symbols)[https://www.hackingwithswift.com/quick-start/swiftui/how-to-animate-sf-symbols])
- Fix a freeze issue in
NavigationViewinsideNavigationStack - Update
ShimmerUI - Update
Tuistdocs ("Access Assets" section etc.) - Add map example with current location access
md5()fileName()fileExtension()isValidEmail()isBlank()
commaSeparatedString(emptyValue:) -> String: Combine string array separated by a comma.
fileSize() -> Int: The file size in KB.
fileSize() -> Int: The file size in KB.
#warning("message")#line#function#file#column#id...#endif#filePath#colorLiteral(red: 0.292, green: 0.081, blue: 0.6, alpha: 255)
Copyright 2021 Md. Mahmudul Hasan Shohag
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.


























