## Introduction
This document provides detailed documentation for the **SwiftMoment** package, version *Package Version*. SwiftMoment is a package for date and time manipulation in Swift, providing convenient functions to work with dates, times, and time intervals. It is licensed under *Package License*.
*Package Keywords*: Swift, Moment, Date, Time, Manipulation, DateFormat
## Package Name
**SwiftMoment** is a powerful Swift library for handling dates, times, and time intervals. This package simplifies common date/time-related tasks and offers a wide range of features, such as:
– String to date conversion
– Date arithmetic
– Timezone calculations
– Relative date calculations
– Date formatting
– Parsing dates from custom formats
– And much more!
## Package Installation
To install **SwiftMoment** in your project, you can use a package manager like [CocoaPods](https://cocoapods.org/). Add the following line to your `Podfile`:
“`ruby
pod ‘SwiftMoment’
“`
Then, run `pod install` to install the package. After that, you can import the module wherever you want to use it in your Swift code.
### Requirements
– iOS 10.0+
– Swift 5.0+
## Package Usage
Using **SwiftMenu** is straightforward. Here are some examples to illustrate its usage:
### Creating a moment
“`swift
import SwiftMoment
let now = Moment() // Create a moment representing the current date and time
let customDate = Moment(year: 2022, month: 10, day: 31) // Create a moment for a specific date
“`
### Date formatting
“`swift
import SwiftMoment
let customDate = Moment(year: 2022, month: 10, day: 31)
let formattedDate = customDate.format(“MMMM d, yyyy”) // Format the date as “October 31, 2022”
“`
### Relative date calculations
“`swift
import SwiftMoment
let now = Moment()
let tomorrow = now.add(1, .Days) // Add 1 day to the current date/moment
let daysBetween = now.intervalUntil(tomorrow, in: .Days) // Get the number of days between two moments
“`
For more details on how to use **SwiftMoment** and its various features, please refer to the [official API documentation](https://example.com).
## Package API Documentation
The official **SwiftMoment** API documentation provides comprehensive details about all the available classes, methods, properties, and their usage. Refer to the [API documentation](https://example.com) for a complete reference guide.
## Package Examples
The **SwiftMoment** package includes various examples to demonstrate its usage and functionality. Here’s an example showcasing how to calculate the difference between two dates:
### Difference between two dates
**Example Description**: Calculate the difference between two dates in days.
“`swift
import SwiftMoment
let date1 = Moment(year: 2022, month: 10, day: 10)
let date2 = Moment(year: 2022, month: 10, day: 15)
let daysDifference = date1.intervalUntil(date2, in: .Days)
print(“The difference between \(date1.format(“MMM d, yyyy”)) and \(date2.format(“MMM d, yyyy”)) is \(daysDifference) days.”)
“`
**Example Output**: The difference between October 10, 2022, and October 15, 2022, is 5 days.
## Package Changelog
The **SwiftMoment** package follows semantic versioning. Here’s a list of notable changes made in each version:
– *Package Version*:
– Added support for time zone conversions.
– Fixed issue with date parsing from custom formats.
– Improved performance for date calculations.
– *Previous Version*:
– Added support for relative date calculations.
– Enhanced date formatting options.
– Fixed bugs related to time zone handling.
For a complete list of changes made in each version, please refer to the [changelog](https://example.com) on the official package repository.
## Package Support
If you encounter any issues, have questions, or need assistance with the **SwiftMoment** package, you can get support through the following channels:
– **Official Documentation**: Refer to the official [documentation](https://example.com) for detailed usage guides and examples.
– **GitHub Repository**: Submit issues or feature requests on the [GitHub repository](https://github.com/example/repo).
– **Community Forums**: Join the official developer community forums for discussions and assistance.
## Conclusion
This document provided detailed documentation for the **SwiftMoment** package. It covered installation instructions, usage examples, API documentation, package support, and additional resources. **SwiftMoment** simplifies various date and time manipulation tasks, making it easier to work with dates, times, and time intervals in Swift.
For more information, please refer to the [official package documentation](https://example.com).