Skip to content

Commit

Permalink
Pointless if they are not public
Browse files Browse the repository at this point in the history
  • Loading branch information
Rui Peres committed Dec 31, 2015
1 parent d6942d5 commit 0c0f1ed
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions OptionalExtensions/Source/OptionalExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import Foundation

extension Optional {
public extension Optional {

func filter(@noescape predicate: Wrapped -> Bool) -> Optional {

Expand All @@ -20,47 +20,47 @@ extension Optional {
return self
}

func replaceNil(with replacement: Wrapped) -> Optional {
public func replaceNil(with replacement: Wrapped) -> Optional {

switch self {
case .Some(_): return self
case .None: return .Some(replacement)
}
}

func apply(@noescape f: Wrapped -> Void) {
public func apply(@noescape f: Wrapped -> Void) {

switch self {
case .Some(let wrapped): f(wrapped)
default: break
}
}

func onSome(@noescape f: Wrapped -> Void) -> Optional {
public func onSome(@noescape f: Wrapped -> Void) -> Optional {

switch self {
case .Some(let wrapped): f(wrapped); return .Some(wrapped)
case .None: return .None
}
}

func onNone(@noescape f: Void -> Void) -> Optional {
public func onNone(@noescape f: Void -> Void) -> Optional {

switch self {
case .Some(let wrapped): return .Some(wrapped)
case .None: f(); return .None
}
}

var isSome: Bool {
public var isSome: Bool {

switch self {
case .Some(_): return true
case .None: return false
}
}

var isNone: Bool {
public var isNone: Bool {

return !isSome
}
Expand Down

0 comments on commit 0c0f1ed

Please sign in to comment.