Skip to content

Commit

Permalink
Make block optional
Browse files Browse the repository at this point in the history
  • Loading branch information
1000ch committed Feb 18, 2017
1 parent b48a8a4 commit 548c5fb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions PinFeed/Managers/BookmarkManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ class BookmarkManager {
}
}

func fetch(block: @escaping () -> ()) {
func fetch(block: (() -> ())?) {
Alamofire
.request(PinboardURLProvider.bookmark ?? "")
.responseJSON { response in
guard let data = response.result.value else {
block()
block?()
return
}

Expand All @@ -42,7 +42,7 @@ class BookmarkManager {
self.bookmark.append(Bookmark(json: json))
}

block()
block?()

try! self.realm.write {
self.realm.delete(self.realm.objects(Bookmarks.self))
Expand Down
6 changes: 3 additions & 3 deletions PinFeed/Managers/TimelineManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ class TimelineManager {
}
}

func fetch(block: @escaping () -> ()) {
func fetch(block: (() -> ())?) {
Alamofire
.request(PinboardURLProvider.network ?? "")
.responseJSON { response in
guard let data = response.result.value else {
block()
block?()
return
}

Expand All @@ -42,7 +42,7 @@ class TimelineManager {
self.timeline.append(Bookmark(json: json))
}

block()
block?()

try! self.realm.write {
self.realm.delete(self.realm.objects(Recents.self))
Expand Down

0 comments on commit 548c5fb

Please sign in to comment.