SwiftFoundation is a collection of useful extensions and utilities for the Swift programming language. This library provides a variety of enhancements to existing Swift types, making common tasks more convenient and efficient. It also includes features for working with URLs, HTTP requests, date and time formatting, encoding/decoding, and more.
To use SwiftFoundation in your project, you can simply include the source files in your project or add it as a Swift Package.
Each extension and utility included in this library extends existing Swift types or provides new functionality to make your code more concise and expressive. Refer to the extensions listed below for details on usage.
jsonArray
sorted(keyPath:ascending:)
toggle(_:)
removeFirst(_:)
safeIndex
toDictionary(_:)
ids
mutate(_:)
init(_:)
toggle()
appVersion
buildNumber
appVersionWithBuildNumber
generateDates(inside:matching:)
urlQueryValueAllowed
isValid
isZero
string
whiteHouse
isWhiteHouse
vCard(title:)
init(placemark:)
codingKeys
unwrapJSONDataBy(key:)
applyBlockForEachJSONObject(_:)
applyBlockForJSONObject(_:)
yesterday
tomorrow
startOfDay
endOfDay
dateByAdding(days:)
noon
day
month
startOfMonth
endOfMonth
isLastDayOfMonth
setTime(from:)
daysDiff(from:)
add(_:)
add(_:to:)
add(_:)
iso8601
medium
full
mediumWithTime
monthFull
monthShort
weekday
weekdayShort
year
jsonString
percentEscaped
SecondsConvertibleComponent
seconds(in:_:)
secondsAs(_:)
dictionary
withSeparator
roundingDownWithSeparator
init(_:)
snakeCaseDecoder
decode(_:as:)
decodeIfPresent(_:)
decodeSafely(_:)
decodeSafelyIfPresent(_:)
byId(asending:)
formattedWithSeparator
roundingDownWithSeparator
capitalizingFirstLetter()
toData(using:)
evaluate(withRegex:)
id
toBase64()
fromBase64()
format(parameters:...)
sliceIncluding(from:to:)
convertHtml()
id
queryFirstValue
queryDict
init(url:method:headers:multipartFormData:)
Equatable
without actually comparing its wrapped value.Faking
protocol.Hashable
without affecting its hash value.SafetyStorage
.This library is released under the MIT license. See LICENSE for details.