Skip to content
This repository has been archived by the owner on Jul 2, 2018. It is now read-only.

Commit

Permalink
Merge branch 'release/1.7.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
danthorpe committed Mar 23, 2016
2 parents 515b902 + 9b5ccc5 commit d483a84
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 20 deletions.
4 changes: 2 additions & 2 deletions .jazzy.yaml → .jazzy.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
author_name: Daniel Thorpe
author_url: http://danthorpe.me
module_name: Money
module_version: 1.6.2
module_version: 1.7.0
github_url: https://github.com/danthorpe/Money
readme: README.md
podspec: Money.podspec

swift_version: 2.1.1
swift_version: 2.2
xcodebuild-arguments: -scheme,Money-iOS

custom_categories:
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 1.7.0
1. [[MNY-47](https://github.com/danthorpe/Money/pull/47)]: Updates to Swift 2.2.

# 1.6.2
1. [[MNY-45](https://github.com/danthorpe/Money/pull/45)]: Fixes a serious bug where `Money` did not have the correct currency scale.

Expand Down
2 changes: 1 addition & 1 deletion Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "danthorpe/ValueCoding" "1.2.0"
github "danthorpe/ValueCoding" "1.3.0"
4 changes: 2 additions & 2 deletions Money.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "Money"
s.version = "1.6.2"
s.version = "1.7.0"
s.summary = "Swift types for working with Money."
s.description = <<-DESC
Expand All @@ -15,7 +15,7 @@ Pod::Spec.new do |s|
s.author = { "Daniel Thorpe" => "@danthorpe" }
s.source = { :git => "https://github.com/danthorpe/Money.git", :tag => s.version.to_s }
s.module_name = 'Money'
s.documentation_url = 'http://docs.danthorpe.me/money/1.6.2/index.html'
s.documentation_url = 'http://docs.danthorpe.me/money/1.7.0/index.html'
s.social_media_url = 'https://twitter.com/danthorpe'
s.requires_arc = true
s.ios.deployment_target = '8.0'
Expand Down
4 changes: 2 additions & 2 deletions Money/Shared/Decimal/DecimalNumberType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ public struct DecimalNumberBehavior {
*/
public protocol DecimalNumberType: Hashable, SignedNumberType, IntegerLiteralConvertible, FloatLiteralConvertible, CustomStringConvertible {

typealias DecimalStorageType
typealias DecimalNumberBehavior: DecimalNumberBehaviorType
associatedtype DecimalStorageType
associatedtype DecimalNumberBehavior: DecimalNumberBehaviorType

/// Access the underlying storage
var storage: DecimalStorageType { get }
Expand Down
22 changes: 12 additions & 10 deletions Money/Shared/Decimal/NSDecimalExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,17 @@ import Foundation

// MARK: - Equality

public func ==(var lhs: NSDecimal, var rhs: NSDecimal) -> Bool {
public func == (lhs: NSDecimal, rhs: NSDecimal) -> Bool {
var (lhs, rhs) = (lhs, rhs)
return NSDecimalCompare(&lhs, &rhs) == .OrderedSame
}

// MARK: - Comparable

extension NSDecimal: Comparable { }

public func <(var lhs: NSDecimal, var rhs: NSDecimal) -> Bool {
public func < (lhs: NSDecimal, rhs: NSDecimal) -> Bool {
var (lhs, rhs) = (lhs, rhs)
return NSDecimalCompare(&lhs, &rhs) == .OrderedAscending
}

Expand Down Expand Up @@ -91,8 +93,8 @@ internal extension NSDecimal {
- returns: a `NSDecimal`.
*/
@warn_unused_result
func subtract(var rhs: NSDecimal, withRoundingMode roundingMode: NSRoundingMode) -> NSDecimal {
var lhs = self
func subtract(rhs: NSDecimal, withRoundingMode roundingMode: NSRoundingMode) -> NSDecimal {
var (lhs, rhs) = (self, rhs)
var result = NSDecimal()
NSDecimalSubtract(&result, &lhs, &rhs, roundingMode)
return result
Expand All @@ -106,8 +108,8 @@ internal extension NSDecimal {
- returns: a `NSDecimal`.
*/
@warn_unused_result
func add(var rhs: NSDecimal, withRoundingMode roundingMode: NSRoundingMode) -> NSDecimal {
var lhs = self
func add(rhs: NSDecimal, withRoundingMode roundingMode: NSRoundingMode) -> NSDecimal {
var (lhs, rhs) = (self, rhs)
var result = NSDecimal()
NSDecimalAdd(&result, &lhs, &rhs, roundingMode)
return result
Expand All @@ -121,8 +123,8 @@ internal extension NSDecimal {
- returns: a `NSDecimal`.
*/
@warn_unused_result
func multiplyBy(var rhs: NSDecimal, withRoundingMode roundingMode: NSRoundingMode) -> NSDecimal {
var lhs = self
func multiplyBy(rhs: NSDecimal, withRoundingMode roundingMode: NSRoundingMode) -> NSDecimal {
var (lhs, rhs) = (self, rhs)
var result = NSDecimal()
NSDecimalMultiply(&result, &lhs, &rhs, roundingMode)
return result
Expand All @@ -136,8 +138,8 @@ internal extension NSDecimal {
- returns: a `NSDecimal`.
*/
@warn_unused_result
func divideBy(var rhs: NSDecimal, withRoundingMode roundingMode: NSRoundingMode) -> NSDecimal {
var lhs = self
func divideBy(rhs: NSDecimal, withRoundingMode roundingMode: NSRoundingMode) -> NSDecimal {
var (lhs, rhs) = (self, rhs)
var result = NSDecimal()
NSDecimalDivide(&result, &lhs, &rhs, roundingMode)
return result
Expand Down
2 changes: 1 addition & 1 deletion Money/Shared/Money.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import ValueCoding
adds a generic type for the currency.
*/
public protocol MoneyType: DecimalNumberType, ValueCoding {
typealias Currency: CurrencyType
associatedtype Currency: CurrencyType

/// Access the underlying decimal
var decimal: _Decimal<Currency> { get }
Expand Down
3 changes: 2 additions & 1 deletion Money/iOS/ApplePay.swift
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,10 @@ public extension PKPaymentRequest {
- parameter sellerName: a `String` which is used in the total cost summary item.
- returns: a `PKPaymentRequest` which has its payment summary items and currency code set.
*/
convenience init<Cost: MoneyType where Cost.DecimalStorageType == NSDecimalNumber, Cost.Coder: NSCoding, Cost.Coder.ValueType == Cost>(var items: [PaymentSummaryItem<Cost>], sellerName: String) {
convenience init<Cost: MoneyType where Cost.DecimalStorageType == NSDecimalNumber, Cost.Coder: NSCoding, Cost.Coder.ValueType == Cost>(items: [PaymentSummaryItem<Cost>], sellerName: String) {
self.init()
currencyCode = Cost.Currency.code
var items = items
let total = items.map { $0.cost }.reduce(0, combine: +)
items.append(PaymentSummaryItem(label: sellerName, cost: total))
paymentSummaryItems = items.map { PKPaymentSummaryItem(paymentSummaryItem: $0) }
Expand Down
2 changes: 1 addition & 1 deletion Supporting Files/Money.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
//

MONEY_VERSION = 1.6.2
MONEY_VERSION = 1.7.0

APPLICATION_EXTENSION_API_ONLY = YES
INFOPLIST_FILE = $(SRCROOT)/Supporting Files/Info.plist
Expand Down

0 comments on commit d483a84

Please sign in to comment.