From aaea9262ed4cf8efa1c45a9eb2d962e457d11fae Mon Sep 17 00:00:00 2001 From: Melvin Rivera Date: Thu, 1 Oct 2020 21:21:25 -0400 Subject: [PATCH] Updated read me and version --- AFDateHelper.podspec | 2 +- DateHelper.xcodeproj/project.pbxproj | 2 ++ README.md | 42 +++++++++++++--------------- Sources/Info.plist | 2 +- 4 files changed, 23 insertions(+), 25 deletions(-) diff --git a/AFDateHelper.podspec b/AFDateHelper.podspec index 0363c9f..8af615c 100644 --- a/AFDateHelper.podspec +++ b/AFDateHelper.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "AFDateHelper" - s.version = "4.3.0" + s.version = "4.4.0" s.summary = "Date Extension for Swift 5" s.description = <<-DESC A Swift Date extension for creating, modifying and comparing dates. diff --git a/DateHelper.xcodeproj/project.pbxproj b/DateHelper.xcodeproj/project.pbxproj index 6eeea92..b2550dc 100644 --- a/DateHelper.xcodeproj/project.pbxproj +++ b/DateHelper.xcodeproj/project.pbxproj @@ -537,6 +537,7 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 11.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MARKETING_VERSION = 4.4.0; MTL_ENABLE_DEBUG_INFO = YES; PRODUCT_BUNDLE_IDENTIFIER = "com.allforces.DateHelper-IOS"; PRODUCT_NAME = DateHelper; @@ -573,6 +574,7 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 11.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MARKETING_VERSION = 4.4.0; MTL_ENABLE_DEBUG_INFO = NO; PRODUCT_BUNDLE_IDENTIFIER = "com.allforces.DateHelper-IOS"; PRODUCT_NAME = DateHelper; diff --git a/README.md b/README.md index a9be65e..68a768e 100644 --- a/README.md +++ b/README.md @@ -5,20 +5,20 @@ [![Platform](https://img.shields.io/cocoapods/p/AFDateHelper.svg?style=flat)](http://cocoapods.org/pods/AFDateHelper) [![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) -A Swift Date extension for iOS, watchOS, tvOS, and macOS that creates or converts dates to or from strings. It can also compare, modify or extract date components and uses cached formatters for performance gains. +A high performant Swift Date Extension for creating, converting, comparing, or modifying dates. ![Sample Project Screenshot](https://raw.githubusercontent.com/melvitax/DateHelper/master/logo.png "Date Helper") ## Capabilities -Convert from string +### String to Date ```Swift date = Date(fromString: "2009-08-11", format: .isoDate) ``` -Convert to string +### Convert to string ```Swift let mediumDateString = date.toString(style: .medium) @@ -27,41 +27,42 @@ let shortTimeString = date.toString(dateStyle: .none, timeStyle: .short) let relativeTimeSting = date.toStringWithRelativeTime() ``` -Compare dates +### Compare dates ```Swift let isToday = date.compare(.isToday) let isSameWeek = date.compare(.isSameWeek(as: otherDate)) ``` -Adjust dates +### Adjust dates ```Swift let twoHoursBefore = date.adjust(.hour, offset: -2) let atNoon = date.adjust(hour: 12, minute: 0, second: 0) ``` -Create dates for... +### Create dates for... ```Swift let startOfWeek = date.dateFor(.startOfWeek) let nearest5Hours = date.dateFor(.nearestHour(hour:5)) ``` -Forcing a week to start on monday +### Forcing a week to start on monday + ```Swift var calendar = Calendar(identifier: .gregorian) calendar = 2 // sets the week to start on the second day.. monday now.dateFor(.startOfWeek, calendar: calendar) ``` -Time since... +### Time since... ```Swift let secondsSince = date.since(otherDate, in: .second) ``` -Extracting components +### Extracting components ```Swift let seconds = date.component(.second) @@ -74,26 +75,21 @@ let lastDayOfWeek = date.lastDayOfWeek() ### Date from string -Use the initializer `Date(detectFromString:String)?` to detect the first date on a string. +**`Date(detectFromString:String)?`** +Use this initializer to detect the first date on a string. ```Swift -if let date = Date(detectFromString: "Sunday, November 1, 2020") -> - { - // Do stuff with date +if let date = Date(detectFromString: "Sunday, November 1, 2020") { + // Do stuff } ``` -Use the initializer `Date(fromString:String, format: DateFormatType)?` to create an optional date from a string. - -/* - Creates a new Date based on the first date detected on a string using data dectors. -*/ -init?(fromString string: String) { +**`Date(fromString:String, format: DateFormatType)?`** +Use this initializer to create an optional date from a string. This uses a chached formatter for perfomance gains. ```Swift -if let date = Date(fromString: "09 Sep 2011 15:26:08 +0200", format: .httpHeader) -> - { - // Do stuff with date +if let date = Date(fromString: "09 Sep 2011 15:26:08 +0200", format: .httpHeader) { + // Do stuff } ``` The DateFormatType enum has a few predifined options as well as a tupple for providing a custom date format. @@ -423,7 +419,7 @@ Minimum: iOS 11, tvOS 12, watchOS 4, macOS 10.14 **Carthage** github "melvitax/DateHelper" **Swift Package Manager** https://github.com/melvitax/DateHelper.git -**Cocoapods** pod 'AFDateHelper', '~> 4.3.0' +**Cocoapods** pod 'AFDateHelper', '~> 4.4.0' **Manually** Include DateHelper.swift in your project diff --git a/Sources/Info.plist b/Sources/Info.plist index 7ca221e..e00fa35 100644 --- a/Sources/Info.plist +++ b/Sources/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 4.3.0 + $(MARKETING_VERSION) CFBundleSignature ???? CFBundleVersion