SwiftUI has more functionality and ease-of-use features on iOS than macOS. SwiftUI + Mack
, on the other hand, makes development more convenient, has built-in workarounds for common issues, and makes interface development quicker and more intuitive. Instead of creating new APIs or capabilities themselves, Mack makes it easier to interact with the tools you aready have. Whether it's making it easier to detect right clicks on a view or simple String
convenience methods, Mack streamlines Swift and SwiftUI every step of the way.
Mack is currently being developed by OCA Creations LLC and the open source community, and is not yet ready for use of any kind. Contributors are welcome - see Contributing for more information. For now, check out the Feature Roadmap, or contribute:
Mack is not a new way to write code. In fact, it aims to be the exact opposite - the functionality that Mack provides should directly augment the code that you write, and seem as natural as any functionality from SwiftUI. The main idea behind the library is to impliment lower-level solutions that are commonly used or workarounds that are currently necessary. For example, SwiftUI does not currently have a way to detect a right click on a View
. Following Apple paradigms as closely as possible, the .onRightClick
modifier provides the same structure as a native modifier, .onTapGesture
, but adds a feature.
"Import and forget": Developers shouldn't even realize they are using features provided by Mack. Functionality should feel so right, so native, that they can type code that Mack provides like it is part of the standard libraries. This is a long way off, but in the end, a developer should be able to use Mack easily and naturally.
- Easy to use: Mack's natural syntax and comprehensive documentation make it a breeze to pick up and integrate into your project.
- Ultramodern: Adding Mack to your project doesn't change any functionality. Mack only provides features that simplify development, but never replaces existing functionality.
- Commonly Used Types: Created with fluidity in mind, Mack solves commonly encountered problems without you having to impliment a workaround. Everything included could (hopefully) be a part of the standard library, and Mack's types are ↩️
- Natively Written: Mack follows Apple stylization guidelines, naming conventions, and documentation methods as closely as possible. Every Mack type should feel like something from out-of-the-box SwiftUI.
- Ultramodern: Mack uses the latest interface technology and Swift versions (though it supports older versions as well), and intregrates directly with your current code. Import Mack and that's it - use all functionality as though it was there already.
- Customizability: Modify Mack components to meet your own requirements, or propose new functionality to the library to solve your solutions. All of Mack aims to be as customizeable as possible.
- macOS 13.0+
- iOS/iPadOS Support not yet available, still a WIP with many features not at all available
- Swift 5.5+ (not tested below 5.8)
- Xcode 14.0+
Mack is available through CocoaPods, Carthage, and the Swift Package Manager (SPM). Choose your preferred dependency manager, and follow the instructions below:
To integrate Mack into your Xcode project using CocoaPods, add the following line to your Podfile
:
pod 'Mack'
Then, run pod install
.
To integrate Mack into your Xcode project using Carthage, add the following line to your Cartfile
:
github "your_username_here/Mack"
Then, run carthage update
and follow the Carthage integration guide to link the built framework to your project.
To integrate Mack into your Xcode project using the Swift Package Manager, add the following to your Package.swift
file:
dependencies: [
.package(url: "https://github.com/OCA-Creations/Mack.git", .upToNextMajor(from: "1.0.0"))
]
To get started with Mack, simply import it into your project:
import Mack
As aformentioned, Mack's goal is to "import and forget". Functionality intregrates seemlessely with standard code (please note that not all functionality below is implimented completely):
import Mack
struct LoginView: View {
//Provided by Mack, the LoginViewController lets you simply store login stuff
//This uses the default config of username, and password
@ObservedObject var controller = LoginViewController(config: .default)
var body: some View {
VStack {
Header("Welcome Back")
TextField("Email", text: $controller.email)
.placeholderColor(.blue)
SecureField("Password", text: $controller.password)
.style(.passwordLight)
Spacer()
Button("Log Me In") {
login()
}
.onRightClick {
print("You have right-clicked this item.")
}
.onChange(of: controller.isLoggedIn) { status in
print("The user \(status? "is" : "is not" ) logged in now.")
}
Text("This text will not allow screenshots.")
.allowsScreenshots(false)
}
.padding()
}
func login() {
//MARK: Example convenience functions, unnecessary
//Retrieve hash from Storage, provided by Mack
let passwordHash = Storage.get("password-hash")
// controller.login with default config requires either a hash function and a hash or two Equatables to compare
let hashOfUserPassword = Crypto.hash(controller.password, .sha256)
//MARK: All that is needed.
//We don't need either of those though.
//This is it. This function will hash the user password, retrieve the real one, and compare the two, and then change isLoggedIn as well as return a bool
let loggedIn = controller.loginWithHash(hash: .sha256, hashLocation: "password-hash")
print("The controller said the user is logged in: \(loggedIn).")
//... That's it!
}
}
For more examples and usage instructions, please refer to the full documentation.
Mack's comprehensive documentation covers everything you need to know, including component guides, styling instructions, and advanced topics.
Thank you for your interest in contributing to Mack! In order to get set up for development, follow these steps:
- Ensure you have the proper software for development: while some Mack features support older OS versions, to develop Mack, you must have macOS 13+ and Xcode 14+ installed. Mack is developed at OCA Creations LLC with Xcode 15 and macOS 13.4.
- Fork this repository
- Clone this repo on your local machine:
git clone https://github.com/YOUR_USERNAME/Mack.git && cd Mack
- Open the Mack folder in Xcode. You can open it with Finder or:
open . -a Xcode
If you have any questions or suggestions, feel free to open an issue.
Mack is released under the MIT License by @OCA-Creations
LLC.