mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Remove extraneous get { from a bunch of read-only accessors.
This commit is contained in:
@@ -14,9 +14,7 @@ public final class DownloadObject: Hashable {
|
||||
public var data = Data()
|
||||
|
||||
public var hashValue: Int {
|
||||
get {
|
||||
return url.hashValue
|
||||
}
|
||||
return url.hashValue
|
||||
}
|
||||
|
||||
public init(url: URL) {
|
||||
|
||||
@@ -35,22 +35,18 @@ public final class DownloadProgress {
|
||||
}
|
||||
|
||||
public var numberCompleted: Int {
|
||||
get {
|
||||
var n = numberOfTasks - numberRemaining
|
||||
if n < 0 {
|
||||
n = 0
|
||||
}
|
||||
if n > numberOfTasks {
|
||||
n = numberOfTasks
|
||||
}
|
||||
return n
|
||||
var n = numberOfTasks - numberRemaining
|
||||
if n < 0 {
|
||||
n = 0
|
||||
}
|
||||
if n > numberOfTasks {
|
||||
n = numberOfTasks
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
public var isComplete: Bool {
|
||||
get {
|
||||
return numberRemaining < 1
|
||||
}
|
||||
return numberRemaining < 1
|
||||
}
|
||||
|
||||
public init(numberOfTasks: Int) {
|
||||
|
||||
@@ -294,9 +294,7 @@ private final class DownloadInfo {
|
||||
var canceled = false
|
||||
|
||||
var statusCode: Int {
|
||||
get {
|
||||
return urlResponse?.forcedStatusCode ?? 0
|
||||
}
|
||||
return urlResponse?.forcedStatusCode ?? 0
|
||||
}
|
||||
|
||||
init(_ representedObject: AnyObject, urlRequest: URLRequest) {
|
||||
|
||||
@@ -12,18 +12,16 @@ public struct HTTPConditionalGetInfo {
|
||||
|
||||
public let lastModified: String?
|
||||
public let etag: String?
|
||||
|
||||
|
||||
public var dictionary: [String: String] {
|
||||
get {
|
||||
var d = [String: String]()
|
||||
if let lastModified = lastModified {
|
||||
d[HTTPResponseHeader.lastModified] = lastModified
|
||||
}
|
||||
if let etag = etag {
|
||||
d[HTTPResponseHeader.etag] = etag
|
||||
}
|
||||
return d
|
||||
var d = [String: String]()
|
||||
if let lastModified = lastModified {
|
||||
d[HTTPResponseHeader.lastModified] = lastModified
|
||||
}
|
||||
if let etag = etag {
|
||||
d[HTTPResponseHeader.etag] = etag
|
||||
}
|
||||
return d
|
||||
}
|
||||
|
||||
public init?(lastModified: String?, etag: String?) {
|
||||
|
||||
@@ -9,23 +9,19 @@
|
||||
import Foundation
|
||||
|
||||
public extension URLResponse {
|
||||
|
||||
|
||||
public var statusIsOK: Bool {
|
||||
get {
|
||||
return forcedStatusCode >= 200 && forcedStatusCode <= 299
|
||||
}
|
||||
return forcedStatusCode >= 200 && forcedStatusCode <= 299
|
||||
}
|
||||
|
||||
|
||||
public var forcedStatusCode: Int {
|
||||
|
||||
get {
|
||||
// Return actual statusCode or -1 if there isn’t one.
|
||||
|
||||
if let response = self as? HTTPURLResponse {
|
||||
return response.statusCode
|
||||
}
|
||||
return 0
|
||||
|
||||
// Return actual statusCode or -1 if there isn’t one.
|
||||
|
||||
if let response = self as? HTTPURLResponse {
|
||||
return response.statusCode
|
||||
}
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user