Introduction
Welcome to the documentation for Cosmos, a versatile iOS framework that simplifies the development process. Cosmos provides tools and components to enhance user interface (UI) and user experience (UX) in your iOS applications.
Features
- Star rating control: Easily implement star rating controls in your app.
- Incremental rating control: Allow users to provide decimal ratings.
- Progress button: Create interactive buttons with progress indication.
- Gradient view: Smoothly transition between multiple colors.
- Badge view: Add informative badges to your UI elements.
- Animated tab bar: Enhance navigation with animated tab bar transitions.
- Customizable tooltips: Provide contextual information to users.
- Image editor: Allow users to crop, rotate, and adjust images.
Installation
CocoaPods
To integrate Cosmos into your Xcode project using CocoaPods, add the following line to your Podfile:
// Podfile
platform :ios, '10.0'
target 'YourProjectName' do
pod 'Cosmos', '~> 25.0'
end
Run the following command in Terminal:
$ pod install
Carthage
To integrate Cosmos into your Xcode project using Carthage, add the following line to your Cartfile:
// Cartfile
github "evgenyneu/Cosmos" ~> 25.0
Run the following command in Terminal:
$ carthage update
Manual Installation
- Download the latest Cosmos release from the GitHub repository.
- Drag and drop the Cosmos folder into your Xcode project.
- In the dialog window, make sure “Copy items if needed” is selected.
- Add the required frameworks and libraries to your project’s “Linked Frameworks and Libraries” section.
Usage
Star Rating Control
The star rating control is a user-friendly way to gather ratings from users. To use Cosmos for star ratings, follow these steps:
- Drag a UIView onto your storyboard or XIB file.
- Change its class to
CosmosView
. - Adjust appearance and behavior properties in Interface Builder or programmatically.
- Use the
rating
property to access or set the currently selected rating. - Implement the
didTouchCosmos
event to perform actions when a rating is selected.
Progress Button
The progress button allows you to create buttons with an animated progress indication. To use the progress button:
- Drag a UIButton onto your storyboard or XIB file.
- Change its class to
ProgressButton
. - Configure the button’s appearance and behavior in Interface Builder or programmatically.
- Use the
progress
property to update the button’s progress animation. - Implement the
didTouchButton
event to handle button interactions.
Gradient View
The gradient view allows you to smoothly transition between multiple colors. To use the gradient view:
- Add a UIView to your storyboard or XIB file.
- Change its class to
GradientView
. - Adjust the view’s appearance and behavior properties in Interface Builder or programmatically.
- Use the
colors
property to specify the gradient colors. - Use the
startPoint
andendPoint
properties to control the gradient direction.
Badge View
The badge view provides a simple way to add informative badges to your UI elements. To use the badge view:
- Drag a UIView onto your storyboard or XIB file.
- Change its class to
BadgeView
. - Configure appearance and behavior properties in Interface Builder or programmatically.
- Use the
text
property to set the badge’s text. - Adjust the
horizontalPadding
andverticalPadding
properties to control the badge size.
Animated Tab Bar
The animated tab bar allows you to enhance navigation by adding animated transitions between tabs. To use the animated tab bar:
- Drag a UITabBarController onto your storyboard or XIB file.
- Change its class to
AnimatedTabBarController
. - Configure and customize appearance properties as desired.
- Use the
animateToTab
property to programmatically switch between tabs. - Implement the
animatedTabBarController
delegate methods to handle tab selection events.
Customizable Tooltips
The customizable tooltips provide contextual information to your users. To use the tooltips:
- Drag a UIView onto your storyboard or XIB file.
- Change its class to
Tooltip
. - Configure the appearance and behavior properties in Interface Builder or programmatically.
- Use the
text
property to set the tooltip’s text. - Use the
arrowDirection
property to specify the tooltip’s arrow direction.
Image Editor
The image editor allows users to crop, rotate, and adjust images. To use the image editor:
- Drag and drop a UIButton onto your storyboard or XIB file.
- Change its class to
ImageEditorViewController
. - Connect your button to the view controller using a segue with identifier
"editorSeque"
. - Use the
ImageEditorDelegate
protocol methods to handle editing completion.
Conclusion
Congratulations! You’ve learned about the features and usage of Cosmos. You can now start enhancing your iOS apps with these intuitive and customizable components.