Skip to content

Commit

Permalink
Fixed Swift 3 issues
Browse files Browse the repository at this point in the history
  • Loading branch information
melvitax committed Sep 9, 2016
1 parent 76b8d6b commit e17f011
Show file tree
Hide file tree
Showing 9 changed files with 82 additions and 33 deletions.
4 changes: 2 additions & 2 deletions AFDateHelper.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

Pod::Spec.new do |s|
s.name = "AFDateHelper"
s.version = "3.4.2"
s.summary = "NSDate Extension for Swift 2.0"
s.version = "3.5.0"
s.summary = "NSDate Extension for Swift 3.0"
s.description = <<-DESC
Extension for NSDate in Swift for creating, modifying or comparing dates.
DESC
Expand Down
35 changes: 20 additions & 15 deletions AFDateHelper.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
objects = {

/* Begin PBXBuildFile section */
63B7E9B61CF6DCFE00E9D8EF /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63B7E9B51CF6DCFE00E9D8EF /* AppDelegate.swift */; };
63B7E9BB1CF6DCFF00E9D8EF /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 63B7E9B91CF6DCFF00E9D8EF /* Main.storyboard */; };
63B7E9BD1CF6DCFF00E9D8EF /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 63B7E9BC1CF6DCFF00E9D8EF /* Assets.xcassets */; };
63B7E9C21CF6DD1300E9D8EF /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65889B721965051C0049740E /* ViewController.swift */; };
63B7E9C31CF6DE8B00E9D8EF /* AFDateExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65D016A019771E80005220FB /* AFDateExtension.swift */; };
65889B711965051C0049740E /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65889B701965051C0049740E /* AppDelegate.swift */; };
65889B731965051C0049740E /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65889B721965051C0049740E /* ViewController.swift */; };
65889B781965051C0049740E /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 65889B771965051C0049740E /* Images.xcassets */; };
65B75F2D19744D6D000AEFD4 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 65B75F2C19744D6D000AEFD4 /* Main.storyboard */; };
65B802BB1D835DF7005361F4 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65B802BA1D835DF7005361F4 /* AppDelegate.swift */; };
65B802BD1D836A06005361F4 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 65B802BC1D836A06005361F4 /* Assets.xcassets */; };
65B802C21D836A18005361F4 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 65B802C01D836A18005361F4 /* Main.storyboard */; };
65D016A119771E80005220FB /* AFDateExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65D016A019771E80005220FB /* AFDateExtension.swift */; };
65D86DED1BA0DB3E0081A0F9 /* Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 65D86DEC1BA0DB3E0081A0F9 /* Launch Screen.storyboard */; };
CD1B226D1CB62C8400992308 /* AFDateHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = CD1B226C1CB62C8400992308 /* AFDateHelper.h */; settings = {ATTRIBUTES = (Public, ); }; };
Expand All @@ -24,9 +24,6 @@

/* Begin PBXFileReference section */
63B7E9B31CF6DCFE00E9D8EF /* AppleTVDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AppleTVDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
63B7E9B51CF6DCFE00E9D8EF /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = AppDelegate.swift; path = AppleTVDemo/AppDelegate.swift; sourceTree = "<group>"; };
63B7E9BA1CF6DCFF00E9D8EF /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
63B7E9BC1CF6DCFF00E9D8EF /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = AppleTVDemo/Assets.xcassets; sourceTree = "<group>"; };
63B7E9BE1CF6DCFF00E9D8EF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; name = Info.plist; path = AppleTVDemo/Info.plist; sourceTree = "<group>"; };
655AEB42192D42990053AD6C /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
655AEB44192D42990053AD6C /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
Expand All @@ -39,6 +36,9 @@
65889B771965051C0049740E /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = AppDemo/Images.xcassets; sourceTree = "<group>"; };
65B75F2C19744D6D000AEFD4 /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = Main.storyboard; path = AppDemo/Main.storyboard; sourceTree = "<group>"; };
65B7EA75197082AA0097E598 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
65B802BA1D835DF7005361F4 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = AppDelegate.swift; path = AppleTVDemo/AppDelegate.swift; sourceTree = SOURCE_ROOT; };
65B802BC1D836A06005361F4 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = AppleTVDemo/Assets.xcassets; sourceTree = SOURCE_ROOT; };
65B802C11D836A18005361F4 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = AppleTVDemo/Base.lproj/Main.storyboard; sourceTree = SOURCE_ROOT; };
65D016A019771E80005220FB /* AFDateExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AFDateExtension.swift; sourceTree = "<group>"; };
65D86DEC1BA0DB3E0081A0F9 /* Launch Screen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = "Launch Screen.storyboard"; path = "AppDemo/Launch Screen.storyboard"; sourceTree = "<group>"; };
65DE9BBB1B3C639D00F66BEC /* AFDateHelper.podspec */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = AFDateHelper.podspec; sourceTree = "<group>"; };
Expand Down Expand Up @@ -75,9 +75,9 @@
63B7E9B41CF6DCFE00E9D8EF /* AppleTVDemo */ = {
isa = PBXGroup;
children = (
63B7E9B51CF6DCFE00E9D8EF /* AppDelegate.swift */,
63B7E9B91CF6DCFF00E9D8EF /* Main.storyboard */,
63B7E9BC1CF6DCFF00E9D8EF /* Assets.xcassets */,
65B802BA1D835DF7005361F4 /* AppDelegate.swift */,
65B802BC1D836A06005361F4 /* Assets.xcassets */,
65B802C01D836A18005361F4 /* Main.storyboard */,
63B7E9BE1CF6DCFF00E9D8EF /* Info.plist */,
);
name = AppleTVDemo;
Expand Down Expand Up @@ -228,6 +228,8 @@
TargetAttributes = {
63B7E9B21CF6DCFE00E9D8EF = {
CreatedOnToolsVersion = 7.3.1;
DevelopmentTeam = ERA9S8SPNY;
LastSwiftMigration = 0800;
};
65889B6B1965051C0049740E = {
CreatedOnToolsVersion = 6.0;
Expand Down Expand Up @@ -265,8 +267,8 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
63B7E9BD1CF6DCFF00E9D8EF /* Assets.xcassets in Resources */,
63B7E9BB1CF6DCFF00E9D8EF /* Main.storyboard in Resources */,
65B802BD1D836A06005361F4 /* Assets.xcassets in Resources */,
65B802C21D836A18005361F4 /* Main.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -294,9 +296,9 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
65B802BB1D835DF7005361F4 /* AppDelegate.swift in Sources */,
63B7E9C31CF6DE8B00E9D8EF /* AFDateExtension.swift in Sources */,
63B7E9C21CF6DD1300E9D8EF /* ViewController.swift in Sources */,
63B7E9B61CF6DCFE00E9D8EF /* AppDelegate.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -321,13 +323,12 @@
/* End PBXSourcesBuildPhase section */

/* Begin PBXVariantGroup section */
63B7E9B91CF6DCFF00E9D8EF /* Main.storyboard */ = {
65B802C01D836A18005361F4 /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
63B7E9BA1CF6DCFF00E9D8EF /* Base */,
65B802C11D836A18005361F4 /* Base */,
);
name = Main.storyboard;
path = AppleTVDemo;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
Expand All @@ -341,6 +342,7 @@
CLANG_ANALYZER_NONNULL = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = ERA9S8SPNY;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_NO_COMMON_BLOCKS = YES;
INFOPLIST_FILE = "$(SRCROOT)/AppleTVDemo/Info.plist";
Expand All @@ -350,6 +352,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 9.0;
};
Expand All @@ -364,6 +367,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = ERA9S8SPNY;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_NO_COMMON_BLOCKS = YES;
INFOPLIST_FILE = "$(SRCROOT)/AppleTVDemo/Info.plist";
Expand All @@ -373,6 +377,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 3.0;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 9.0;
};
Expand Down
6 changes: 3 additions & 3 deletions AFDateHelper/AFDateExtension.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// AFDateExtension.swift
//
// Version 3.4.2
// Version 3.5.0
//
// Created by Melvin Rivera on 7/15/14.
// Copyright (c) 2014. All rights reserved.
Expand Down Expand Up @@ -127,7 +127,7 @@ public extension Date {

var s = string
if string.hasSuffix("Z") {
s = s.substring(to: s.length-1) + "GMT"
s = s.substring(to: s.length-1).appending("GMT") as NSString
}
let formatter = Date.formatter(RSSFormat)
if let date = formatter.date(from: string as String) {
Expand All @@ -140,7 +140,7 @@ public extension Date {

var s = string
if string.hasSuffix("Z") {
s = s.substring(to: s.length-1) + "GMT"
s = s.substring(to: s.length-1).appending("GMT") as NSString
}
let formatter = Date.formatter(AltRSSFormat)
if let date = formatter.date(from: string as String) {
Expand Down
2 changes: 1 addition & 1 deletion AppDemo/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import UIKit
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject : AnyObject]?) -> Bool {
private func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject : AnyObject]?) -> Bool {
return true
}
}
Expand Down
20 changes: 20 additions & 0 deletions AppDemo/Images.xcassets/AppIcon.appiconset/Contents.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
{
"images" : [
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "29x29",
Expand Down Expand Up @@ -30,6 +40,16 @@
"size" : "60x60",
"scale" : "3x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "29x29",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
"filename" : "App Icon - Small.imagestack",
"role" : "primary-app-icon"
},
{
"size" : "2320x720",
"idiom" : "tv",
"filename" : "Top Shelf Image Wide.imageset",
"role" : "top-shelf-image-wide"
},
{
"size" : "1920x720",
"idiom" : "tv",
Expand All @@ -23,4 +29,4 @@
"version" : 1,
"author" : "xcode"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"idiom" : "tv",
"scale" : "1x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
24 changes: 15 additions & 9 deletions AppleTVDemo/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder.AppleTV.Storyboard" version="3.0" toolsVersion="10116" systemVersion="15F34" targetRuntime="AppleTV" propertyAccessControl="none" useAutolayout="YES" initialViewController="aCC-02-Ll6">
<document type="com.apple.InterfaceBuilder.AppleTV.Storyboard" version="3.0" toolsVersion="11201" systemVersion="15G1004" targetRuntime="AppleTV" propertyAccessControl="none" useAutolayout="YES" colorMatched="YES" initialViewController="aCC-02-Ll6">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11161"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--AF Date Helper-->
Expand All @@ -12,25 +13,25 @@
<rect key="frame" x="0.0" y="0.0" width="1920" height="1080"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<prototypes>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="Cell" textLabel="xB1-Nh-lUV" detailTextLabel="5Jl-vJ-u5f" style="IBUITableViewCellStyleSubtitle" id="l92-ER-B8g">
<rect key="frame" x="0.0" y="199" width="1880" height="100"/>
<tableViewCell contentMode="scaleToFill" misplaced="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="Cell" textLabel="xB1-Nh-lUV" detailTextLabel="5Jl-vJ-u5f" style="IBUITableViewCellStyleSubtitle" id="l92-ER-B8g">
<rect key="frame" x="0.0" y="185" width="1880" height="100"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="l92-ER-B8g" id="efk-YQ-gde">
<rect key="frame" x="0.0" y="0.0" width="1904" height="100"/>
<frame key="frameInset" width="1904" height="100"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="xB1-Nh-lUV">
<rect key="frame" x="20" y="4" width="72" height="46"/>
<frame key="frameInset" minX="20" minY="4" width="72" height="46"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="38"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Subtitle" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="5Jl-vJ-u5f">
<rect key="frame" x="20" y="50" width="128" height="46"/>
<frame key="frameInset" minX="20" minY="50" width="128" height="46"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="38"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.40000000000000002" colorSpace="calibratedRGB"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
Expand Down Expand Up @@ -65,4 +66,9 @@
<point key="canvasLocation" x="-1553" y="381"/>
</scene>
</scenes>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<nil key="statusBar"/>
<simulatedOrientationMetrics key="orientation" orientation="landscapeRight"/>
<simulatedScreenMetrics key="destination"/>
</simulatedMetricsContainer>
</document>
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[![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)

An NSDate Extension for Swift 2.0
An NSDate Extension for Swift 3.0

![Sample Project Screenshot](https://raw.githubusercontent.com/melvitax/AFDateHelper/master/Screenshot.png "Sample Project Screenshot")

Expand Down Expand Up @@ -173,4 +173,4 @@ Melvin Rivera, melvin@allforces.com

## License

AFDateHelper is available under the MIT license. See the LICENSE file for more info.
AFDateHelper is available under the MIT license. See the LICENSE file for more info.

0 comments on commit e17f011

Please sign in to comment.