Skip to content

Commit

Permalink
Merge pull request #4 from xmartlabs/swift5
Browse files Browse the repository at this point in the history
Updates for Swift 5
  • Loading branch information
mats-claassen authored Apr 8, 2019
2 parents 7fa1858 + db902cb commit d3db801
Show file tree
Hide file tree
Showing 11 changed files with 74 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .swift-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.0
5.0
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
language: objective-c
osx_image: xcode9
osx_image: xcode10.2
env:
- DESTINATION="OS=11.0,name=iPhone X" SCHEME="Ecno" SDK=iphonesimulator11.0
- DESTINATION="OS=12.2,name=iPhone X" SCHEME="Ecno" SDK=iphonesimulator12.2
before_install:
- gem install xcpretty --no-rdoc --no-ri --no-document --quiet
- gem install xcpretty --quiet
script:
- set -o pipefail
- xcodebuild -version
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
# Change Log
All notable changes to Ecno will be documented in this file.

### [3.0.0](https://github.com/xmartlabs/Ecno/releases/tag/3.0.0)
<!-- Released on 2019-04-08. -->

* Swift 5 support


### [2.0.0](https://github.com/xmartlabs/Ecno/releases/tag/2.0.0)
<!-- Released on 2017-10-02. -->

* Swift 4 support

### [1.0.0](https://github.com/xmartlabs/Ecno/releases/tag/1.0.0)
<!-- Released on 2016-01-20. -->

Expand Down
7 changes: 4 additions & 3 deletions Ecno.podspec
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
Pod::Spec.new do |s|
s.name = "Ecno"
s.version = "2.0.0"
s.summary = "Ecno is a task state manager built on top of UserDefaults in pure Swift 4"
s.version = "3.0.0"
s.summary = "Ecno is a task state manager built on top of UserDefaults"
s.homepage = "https://github.com/xmartlabs/Ecno"
s.license = { type: 'MIT', file: 'LICENSE' }
s.author = { "Diego Ernst" => "dernst@xmartlabs.com" }
s.source = { git: "https://github.com/xmartlabs/Ecno.git", tag: "2.0.0" }
s.source = { git: "https://github.com/xmartlabs/Ecno.git", tag: "3.0.0" }
s.social_media_url = 'http://twitter.com/xmartlabs'
s.ios.deployment_target = '8.0'
s.requires_arc = true
s.ios.source_files = 'Sources/**/*'
s.swift_version = '5.0'
end
32 changes: 25 additions & 7 deletions Ecno.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -184,15 +184,16 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0730;
LastUpgradeCheck = 0900;
LastUpgradeCheck = 1010;
TargetAttributes = {
28F8287C1C494B2C00330CF4 = {
CreatedOnToolsVersion = 7.2;
LastSwiftMigration = 0900;
LastSwiftMigration = 1010;
ProvisioningStyle = Automatic;
};
28F828861C494B2C00330CF4 = {
CreatedOnToolsVersion = 7.2;
LastSwiftMigration = 0800;
LastSwiftMigration = 1010;
};
};
};
Expand All @@ -201,6 +202,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
);
mainGroup = 28F828731C494B2C00330CF4;
Expand Down Expand Up @@ -293,12 +295,14 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
Expand Down Expand Up @@ -349,12 +353,14 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
Expand Down Expand Up @@ -391,8 +397,11 @@
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
CODE_SIGN_STYLE = Automatic;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
Expand All @@ -401,19 +410,23 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.xmartlabs.Ecno;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
28F828931C494B2C00330CF4 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
CODE_SIGN_STYLE = Automatic;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
Expand All @@ -422,34 +435,39 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.xmartlabs.Ecno;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SKIP_INSTALL = YES;
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
};
name = Release;
};
28F828951C494B2C00330CF4 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_MODULES = YES;
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = Tests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.xmartlabs.EcnoTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
28F828961C494B2C00330CF4 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_MODULES = YES;
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = Tests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.xmartlabs.EcnoTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.2;
};
name = Release;
};
Expand Down
2 changes: 1 addition & 1 deletion Ecno.xcodeproj/xcshareddata/xcschemes/Ecno.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0900"
LastUpgradeVersion = "1010"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
8 changes: 8 additions & 0 deletions Ecno.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
6 changes: 5 additions & 1 deletion Example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0720;
LastUpgradeCheck = 0900;
LastUpgradeCheck = 1010;
TargetAttributes = {
28F828CB1C4B714D00330CF4 = {
CreatedOnToolsVersion = 7.2;
Expand Down Expand Up @@ -351,12 +351,14 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
Expand Down Expand Up @@ -403,12 +405,14 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
Expand Down
2 changes: 1 addition & 1 deletion Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0900"
LastUpgradeVersion = "1010"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<p align="center">
<a href="https://travis-ci.org/xmartlabs/Ecno"><img src="https://travis-ci.org/xmartlabs/Ecno.svg?branch=master" alt="Build status" /></a>
<img src="https://img.shields.io/badge/platform-iOS-blue.svg?style=flat" alt="Platform iOS" />
<a href="https://developer.apple.com/swift"><img src="https://img.shields.io/badge/swift4-compatible-4BC51D.svg?style=flat" alt="Swift 4 compatible" /></a>
<a href="https://developer.apple.com/swift"><img src="https://img.shields.io/badge/swift5-compatible-4BC51D.svg?style=flat" alt="Swift 5 compatible" /></a>
<a href="https://github.com/Carthage/Carthage"><img src="https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat" alt="Carthage compatible" /></a>
<a href="https://cocoapods.org/pods/Ecno"><img src="https://img.shields.io/cocoapods/v/Ecno.svg" alt="CocoaPods compatible" /></a>
<a href="https://raw.githubusercontent.com/xmartlabs/Ecno/master/LICENSE"><img src="http://img.shields.io/badge/license-MIT-blue.svg?style=flat" alt="License: MIT" /></a>
Expand Down Expand Up @@ -144,7 +144,7 @@ Follow these 3 steps to run Example project:
To install Ecno, simply add the following line to your Podfile:

```ruby
pod 'Ecno', '~> 1.0'
pod 'Ecno', '~> 3.0'
```

#### Carthage
Expand All @@ -154,7 +154,7 @@ pod 'Ecno', '~> 1.0'
To install Ecno, simply add the following line to your Cartfile:

```ogdl
github "xmartlabs/Ecno" ~> 1.0
github "xmartlabs/Ecno" ~> 3.0
```

## Author
Expand Down
24 changes: 12 additions & 12 deletions Sources/Ecno.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ open class Ecno {
/**
Initializer method. It must be called before start using any Ecno method.
*/
open static func initialize() {
public static func initialize() {
let userDefaults = UserDefaults.standard
let currentAppVersion = appVersion()
let userDefaultsAppVersion = userDefaults.string(forKey: Constants.appVersionKey)
Expand All @@ -69,7 +69,7 @@ open class Ecno {
- parameter scope: The scope to not repeat the to do task in.
- parameter info: Additional info for the to do task.
*/
open static func toDo(_ task: Task, scope: Scope? = nil, info: [AnyHashable: Any]? = nil) {
public static func toDo(_ task: Task, scope: Scope? = nil, info: [AnyHashable: Any]? = nil) {
guard let scope = scope else {
toDoSet.add(task, scope: .appInstall, withInfo: info)
return
Expand All @@ -90,7 +90,7 @@ open class Ecno {

- returns: Whether or not the task needs to be done.
*/
open static func needToDo(_ task: Task) -> Bool {
public static func needToDo(_ task: Task) -> Bool {
return toDoSet.getDataForTask(task).map { isScope($0.scope, containing: Date()) } ?? false
}

Expand All @@ -101,7 +101,7 @@ open class Ecno {

- returns: The info of the 'to do' task if it exists.
*/
open static func infoForToDo(_ task: Task) -> [AnyHashable: Any]? {
public static func infoForToDo(_ task: Task) -> [AnyHashable: Any]? {
return toDoSet.getDataForTask(task)?.info
}

Expand All @@ -112,7 +112,7 @@ open class Ecno {

- returns: The task's last timestamp or `nil` if it does not exist.
*/
open static func lastDone(_ task: Task) -> Date? {
public static func lastDone(_ task: Task) -> Date? {
return timestampsDictionary[task].last
}

Expand All @@ -125,7 +125,7 @@ open class Ecno {

- returns: Whether or not the task has been done within the given constraints.
*/
open static func beenDone(_ task: Task, scope: Scope = .appInstall, numberOfTimes: CountChecker = .moreThan(0)) -> Bool {
public static func beenDone(_ task: Task, scope: Scope = .appInstall, numberOfTimes: CountChecker = .moreThan(0)) -> Bool {
let timestamps = timestampsDictionary[task]
let dateInScope = filterDateInScope(scope)
return !timestamps.isEmpty && numberOfTimes.check(timestamps.filter(dateInScope).count)
Expand All @@ -136,7 +136,7 @@ open class Ecno {

- parameter task: The task to mark as done.
*/
open static func markDone(_ task: Task) {
public static func markDone(_ task: Task) {
timestampsDictionary[task] = timestampsDictionary[task] + [Date()]
toDoSet.remove(task)
}
Expand All @@ -146,7 +146,7 @@ open class Ecno {

- parameter task: The task to be cleared.
*/
open static func clearDone(_ task: Task) {
public static func clearDone(_ task: Task) {
timestampsDictionary[task] = []
}

Expand All @@ -155,28 +155,28 @@ open class Ecno {

- parameter task: The task to be removed from 'to do'.
*/
open static func clearToDo(_ task: Task) {
public static func clearToDo(_ task: Task) {
toDoSet.remove(task)
}

/**
Clears all 'done' marks for all tasks.
*/
open static func clearDoneTasks() {
public static func clearDoneTasks() {
timestampsDictionary.clear()
}

/**
Removes all tasks from their 'to do' state.
*/
open static func clearToDoTasks() {
public static func clearToDoTasks() {
toDoSet.clear()
}

/**
Clear all 'done' and 'to do' tasks.
*/
open static func clearAll() {
public static func clearAll() {
clearDoneTasks()
clearToDoTasks()
}
Expand Down

0 comments on commit d3db801

Please sign in to comment.