Skip to content
This repository has been archived by the owner on Jan 31, 2020. It is now read-only.

Commit

Permalink
Merge pull request #89 from alexkunitsa/swift_2_fix
Browse files Browse the repository at this point in the history
Fixed issues to support Swift 2.0
  • Loading branch information
kevinlawler committed Sep 28, 2015
2 parents 4ec0349 + bcd3f17 commit 2501347
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions NSDate+Extension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,16 @@ let kMonth = kDay * 31
let kYear = kDay * 365

func NSDateTimeAgoLocalizedStrings(key: String) -> String {
guard let resourcePath = NSBundle.mainBundle().resourcePath else {
return ""
}

let resourcePath = NSBundle.mainBundle().resourcePath
let path = resourcePath?.stringByAppendingPathComponent("NSDateTimeAgo.bundle")
let bundle = NSBundle(path: path!)
let path = NSURL(fileURLWithPath:resourcePath).URLByAppendingPathComponent("NSDateTimeAgo.bundle")
guard let bundle = NSBundle(URL: path) else {
return ""
}

return NSLocalizedString(key, tableName: "NSDateTimeAgo", bundle: bundle!, comment: "")
return NSLocalizedString(key, tableName: "NSDateTimeAgo", bundle: bundle, comment: "")
}

extension NSDate {
Expand Down Expand Up @@ -133,8 +137,9 @@ extension NSDate {
}

func getLocaleFormatUnderscoresWithValue(value: Double) -> String {

let localeCode = NSLocale.preferredLanguages().first as String
guard let localeCode = NSLocale.preferredLanguages().first else {
return ""
}

if localeCode == "ru" {
let XY = Int(floor(value)) % 100
Expand Down

0 comments on commit 2501347

Please sign in to comment.