TSwiftHelper is a powerful and lightweight Swift library designed to accelerate iOS development with a comprehensive collection of helper classes and extension functions. It provides ready-to-use UI components and utilities that eliminate boilerplate code and enhance development productivity.
- π¨ UI Component Helpers: Pre-configured UI components with style management
- π± Native iOS Integration: Seamless integration with iOS SDK
- π§ Utility Extensions: Helpful extension functions for common development tasks
- β‘ Performance Optimized: Lightweight and efficient implementation
- π Easy Configuration: Simple and intuitive API design
- π― Type Safe: Leverages Swift's type system for safer code
- π¦ Multiple Installation Options: CocoaPods, Swift Package Manager, and Manual
- iOS: 11.0+
- Swift: 5.0+
- Xcode: 11.0+
CocoaPods is the recommended way to install TSwiftHelper. Add the following line to your Podfile
:
pod 'TSwiftHelper'
Then run:
pod install
Add TSwiftHelper to your project through Xcode's Package Manager:
- File β Add Package Dependencies
- Enter package URL:
https://github.com/fanta1ty/TSwiftHelper.git
- Select version and add to your target
Or add it to your Package.swift
file:
dependencies: [
.package(url: "https://github.com/fanta1ty/TSwiftHelper.git", from: "master")
]
Simply drag and drop the files in the TSwiftHelper/TSwiftHelper
folder into your project.
Import TSwiftHelper in your Swift files:
import TSwiftHelper
Create beautifully styled labels with minimal code:
let titleLabel = LabelHelper(
style: LabelStyle(
backgroundColor: .clear,
borderColor: .clear,
borderWidth: 0,
cornerRadius: 0,
textColor: .black,
textFont: .regular(size: 16),
textAlignment: .center,
numberOfLines: 1,
isHidden: false
),
text: "Welcome to TSwiftHelper!"
)
Create interactive buttons with custom styling:
let actionButton = ButtonHelper(
style: ButtonStyle(
backgroundColor: .blue,
borderColor: .black,
borderWidth: 1,
cornerRadius: 8,
textColor: .white,
textFont: .regular(size: 16),
clipsToBounds: true,
isHidden: false,
isUserInteractionEnabled: true
),
title: "Tap Me!",
normalImage: "button_icon".uiImage,
selectedImage: "button_icon_selected".uiImage
)
Create styled text input fields:
let usernameField = TextFieldHelper(
style: TextFieldStyle(
backgroundColor: .clear,
borderColor: .black,
borderWidth: 1,
cornerRadius: 8,
textColor: .black,
textFont: .regular(size: 16),
textAlignment: .left,
keyboardType: .default,
isSecureTextEntry: false,
autocorrectionType: .default,
spellCheckingType: .no,
autocapitalizationType: .none,
clearButtonMode: .never,
isHidden: false,
isUserInteractionEnabled: true
),
text: "",
placeholder: "Enter username"
)
Create custom views with styling:
let containerView = ViewHelper(
style: ViewStyle(
backgroundColor: .clear,
borderColor: .clear,
borderWidth: 0,
cornerRadius: 0,
clipsToBounds: true,
isHidden: false,
isUserInteractionEnabled: true
)
)
Create styled image views:
let profileImageView = ImageViewHelper(
style: ImageViewStyle(
backgroundColor: .clear,
borderColor: .black,
borderWidth: 1,
cornerRadius: 10,
contentMode: .scaleAspectFill,
clipsToBounds: true,
isHidden: false
),
iconImage: "profile_placeholder".uiImage
)
Create configured table views with automatic cell registration:
let tableView = TableViewHelper(
style: TableViewStyle(
backgroundColor: .clear,
borderColor: .clear,
borderWidth: 0,
cornerRadius: 0,
clipsToBounds: true,
isHidden: false,
isUserInteractionEnabled: true
),
cellClasses: [CustomTableViewCell.self],
cellIdentifiers: [CustomTableViewCell.reuseIdentifier]
)
// In viewDidLoad()
override func viewDidLoad() {
super.viewDidLoad()
tableView.registerCells()
}
Create styled collection views with automatic cell registration:
let collectionView = CollectionViewHelper(
style: CollectionViewStyle(
backgroundColor: .clear,
borderColor: .black,
borderWidth: 1,
cornerRadius: 4,
clipsToBounds: true,
isHidden: false,
isUserInteractionEnabled: true
),
collectionViewLayout: UICollectionViewFlowLayout(),
cellClasses: [CustomCollectionViewCell.self],
cellIdentifiers: [CustomCollectionViewCell.reuseIdentifier]
)
// In viewDidLoad()
override func viewDidLoad() {
super.viewDidLoad()
collectionView.registerCells()
}
Display date picker with customizable options:
PickerHelper.selectDate(
title: "Select Date",
hideCancel: false,
datePickerMode: .dateAndTime,
selectedDate: Date(),
minDate: nil,
maxDate: Date().dateByAddingYears(5)
) { selectedDate in
print("Selected date: \(selectedDate)")
// Handle selected date
}
Display option picker for multiple choices:
let options = ["Option 1", "Option 2", "Option 3", "Option 4", "Option 5"]
PickerHelper.selectOption(dataArray: options) { [weak self] value, index in
print("Selected: \(value) at index: \(index)")
// Handle selected option
}
TSwiftHelper uses a comprehensive style system that allows you to:
- Consistent Styling: Apply consistent visual styling across your app
- Reusable Styles: Create and reuse style configurations
- Dynamic Theming: Easily switch between different visual themes
- Type Safety: Compile-time checking for style properties
The library includes a convenient .uiImage
extension for cleaner image handling:
// Instead of UIImage(named: "image_name")
let image = "image_name".uiImage
For table views and collection views, TSwiftHelper automatically handles cell registration using the reuseIdentifier
property.
Check out the example project in the repository to see TSwiftHelper in action with real-world usage scenarios.
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
- None currently reported
If you encounter any issues or have questions:
- Check the Issues page
- Create a new issue with detailed information
- Contact the maintainer
- The Swift community for inspiration and feedback
- Contributors who help improve the library
- iOS developers who use and test TSwiftHelper
TSwiftHelper is available under the MIT license. See the LICENSE file for more information.
fanta1ty
- GitHub: @fanta1ty
Made with β€οΈ for the iOS development community
If this library helps you in your projects, please consider giving it a βοΈ on GitHub!