Skip to content

Commit

Permalink
Merge branch 'release/4.0.1' into versions
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeehut committed Mar 25, 2024
2 parents 669d64e + a2768b1 commit 0c7ecab
Show file tree
Hide file tree
Showing 12 changed files with 17 additions and 6 deletions.
Binary file modified Images/Docs.webp
Binary file not shown.
Binary file added Images/HandySwift.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed Images/HandySwift.webp
Binary file not shown.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<img src="https://raw.githubusercontent.com/FlineDev/HandySwift/main/Images/HandySwift.webp" width="256" />
<img src="https://raw.githubusercontent.com/FlineDev/HandySwift/main/Images/HandySwift.png" width="256" />

[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2FFlineDev%2FHandySwift%2Fbadge%3Ftype%3Dplatforms)](https://swiftpackageindex.com/FlineDev/HandySwift)

# HandySwift

The goal of this library is to **provide handy features** that didn't make it into the Swift standard library (yet).

Checkout [HandySwiftUI](https://github.com/FlineDev/HandySwitUI) for handy UI features that should have been part of SwiftUI in the first place.
Checkout [HandySwiftUI](https://github.com/FlineDev/HandySwiftUI) for handy UI features that should have been part of SwiftUI in the first place.


## Documentation
Expand Down
4 changes: 3 additions & 1 deletion Sources/HandySwift/Extensions/DurationExt.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,10 @@ extension Duration {
/// - For a duration of 25 hours, the output will be `"1d 1h"`, scaling up to days and hours.
/// - For a duration of 2 days and 0 hours, the output will be `"2d"` as it omits the zero hour part.
///
/// - Returns: A formatted string representing the duration. If the duration is less than a second, it returns `"???"`.
/// - Returns: A formatted string representing the duration. If the duration is less than a second, it returns `"???"`. For zero returns `"0s"`.
public func autoscaleFormatted() -> String {
guard self != .zero else { return "0s" }

var leftoverTimeInterval = self.timeInterval
let fullDays = Int(leftoverTimeInterval.days)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ var nextEntry: ApplicationMusicPlayer.Queue.Entry? {

You can use it on every type that conforms to ``Swift/Collection`` including `Array`, `Dictionary`, and `String`. Instead of calling the subscript `array[index]` which returns a non-Optional but crashes when the index is out of bounds, use the safer `array[safe: index]` which returns `nil` instead of crashing in those cases.

### Blank Strings vs Empty Strings
#### Blank Strings vs Empty Strings

![](APIKeys)

Expand Down
Binary file modified Sources/HandySwift/HandySwift.docc/Resources/Extensions.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Sources/HandySwift/HandySwift.docc/Resources/HandySwift.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Sources/HandySwift/HandySwift.docc/Resources/NewTypes.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions Sources/HandySwift/HandySwift.docc/theme-settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"theme": {
"color": {
"header": "#002B7D",
"documentation-intro-fill": "radial-gradient(circle at top, var(--color-header) 30%, #000 100%)",
"documentation-intro-accent": "var(--color-header)"
}
}
}
2 changes: 1 addition & 1 deletion Sources/HandySwift/Types/GregorianDay.swift
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public struct GregorianDay {
/// - Parameter timeZone: The time zone for which to calculate the middle of the day. Defaults to UTC.
/// - Returns: A `Date` representing the middle of the day.
///
/// - Note: If you need to pass a `Date` to an API that only cares about the day (not the time), calling ``midOfDay()`` ensures you get the same day independent of timezones.
/// - Note: If you need to pass a `Date` to an API that only cares about the day (not the time), calling ``midOfDay(timeZone:)`` ensures you get the same day independent of timezones.
///
/// Example:
/// ```swift
Expand Down
2 changes: 1 addition & 1 deletion Sources/HandySwift/Types/HandyRegex.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Foundation

/// `HandyRegex` is a swifty regex engine built on top of the NSRegularExpression API.
///
/// > Warning: The HandyRegex type will be removed in a future version. Migrate to ``Swift.Regex`` if possible.
/// > Warning: The HandyRegex type will be removed in a future version. Migrate to `Swift.Regex` if possible.
///
/// #### init(_:options:)
///
Expand Down

0 comments on commit 0c7ecab

Please sign in to comment.