xcore
xcore copied to clipboard
A collection of hundreds of Swift and SwiftUI extensions and components designed to minimize boilerplate to accomplish common tasks with ease.
Xcore is a collection of hundreds of Swift extensions and components designed to minimize boilerplate to accomplish common tasks with ease. It is a framework to efficiently build and scale apps without compromising quality, maintainability and developer productivity. Check out the included example project and documentation to see how.
Contents
- Requirements
- Makefile
- Installation
- Documentation
Requirements
- iOS 14.0+
- Xcode 13.0+
- Swift 5.5+
Additional Requirements
Makefile
We use make file to provide some useful shortcuts. Run any of the below commands at the project root level.
-
make test
Runs all tests -
make lint
Runs SwiftLint -
make format
Runs SwiftFormat
Installation
Swift Package Manager
Xcore is available through Swift Package Manager. To integrate it into a project, add it as a dependency within your Package.swift
manifest:
let package = Package(
...
dependencies: [
.package(name: "Xcore", url: "https://github.com/zmian/xcore", .branch("main"))
],
...
)
CocoaPods
Xcore is available through CocoaPods. To integrate Xcore into your Xcode project using CocoaPods, simply add the following line to your Podfile
:
pod 'Xcore'
Latest version
pod 'Xcore', :git => 'https://github.com/zmian/xcore'
Third-Party Extensions
Xcore provides extensions for various third-party frameworks. They are behind #if canImport
flag to avoid linking these frameworks as hard dependencies.
To enable these extension in your own project, simply add the following script in your podfile
:
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
if target.name == "Xcore" then
# Exposing Carthage frameworks
#
# Expose `Vendor` (Carthage) directory to Xcore so we can get conditional extensions.
config.build_settings['FRAMEWORK_SEARCH_PATHS'] ||= ['$(inherited)', '${PODS_ROOT}/../Vendor']
# Exposing CocoaPods frameworks
#
# Or expose `SnapKit` pod to Xcore so we can get conditional extensions.
config.build_settings['FRAMEWORK_SEARCH_PATHS'] ||= ['$(inherited)', '${PODS_CONFIGURATION_BUILD_DIR}/SnapKit']
# Link `SnapKit` framework to Xcore so the conditional canImport flag works.
config.build_settings['OTHER_LDFLAGS'] ||= ['$(inherited)', '-framework "SnapKit"']
end
end
end
end
Replace '${PODS_ROOT}/../Vendor'
with location of your frameworks directory.
Note: This script can also make your Carthage dependencies visible to Xcore so you can use these conditional extensions.
Documentation
You can find the documentation here.
Documentation is generated with jazzy and hosted on GitHub-Pages. To regenerate documentation, run ./Scripts/build_docs.sh
from the root directory in the repo.
Author
License
Xcore is released under the MIT license. See LICENSE for details.