diff --git a/Cartfile b/Cartfile index cc79ca3..e4a488e 100644 --- a/Cartfile +++ b/Cartfile @@ -1,5 +1,5 @@ -github "Alamofire/Alamofire" >= 1.3 +github "Alamofire/Alamofire" >= 2.0 github "mattt/Ono" >= 1.2.2 -github "burntcaramel/BurntFoundation" >= 0.1 -github "burntcaramel/BurntCocoaUI" >= 0.2 -github "burntcaramel/BurntList" >= 0.2 +github "burntcaramel/BurntFoundation" >= 0.2 +github "burntcaramel/BurntCocoaUI" >= 0.3 +github "burntcaramel/BurntList" >= 0.3 diff --git a/Cartfile.resolved b/Cartfile.resolved index 4b05506..9f5c80b 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,5 +1,5 @@ -github "Alamofire/Alamofire" "1.3.1" -github "burntcaramel/BurntCocoaUI" "0.2.2" -github "burntcaramel/BurntFoundation" "0.1.5" -github "burntcaramel/BurntList" "0.2.2" +github "Alamofire/Alamofire" "2.0.2" +github "burntcaramel/BurntCocoaUI" "0.3.0" +github "burntcaramel/BurntFoundation" "0.2.0" +github "burntcaramel/BurntList" "0.3.0" github "mattt/Ono" "1.2.2" diff --git a/Carthage/Build/Mac/Alamofire.framework/Versions/A/Alamofire b/Carthage/Build/Mac/Alamofire.framework/Versions/A/Alamofire index 8b2b6b9..a3dc256 100755 Binary files a/Carthage/Build/Mac/Alamofire.framework/Versions/A/Alamofire and b/Carthage/Build/Mac/Alamofire.framework/Versions/A/Alamofire differ diff --git a/Carthage/Build/Mac/Alamofire.framework/Versions/A/Headers/Alamofire-Swift.h b/Carthage/Build/Mac/Alamofire.framework/Versions/A/Headers/Alamofire-Swift.h index 8cbfc61..e91c07c 100644 --- a/Carthage/Build/Mac/Alamofire.framework/Versions/A/Headers/Alamofire-Swift.h +++ b/Carthage/Build/Mac/Alamofire.framework/Versions/A/Headers/Alamofire-Swift.h @@ -1,4 +1,4 @@ -// Generated by Apple Swift version 1.2 (swiftlang-602.0.53.1 clang-602.0.53) +// Generated by Apple Swift version 2.0 (swiftlang-700.0.59 clang-700.0.72) #pragma clang diagnostic push #if defined(__has_include) && __has_include() @@ -33,6 +33,11 @@ typedef struct _NSZone NSZone; #else # define SWIFT_RUNTIME_NAME(X) #endif +#if defined(__has_attribute) && __has_attribute(swift_name) +# define SWIFT_COMPILE_NAME(X) __attribute__((swift_name(X))) +#else +# define SWIFT_COMPILE_NAME(X) +#endif #if !defined(SWIFT_CLASS_EXTRA) # define SWIFT_CLASS_EXTRA #endif @@ -45,13 +50,16 @@ typedef struct _NSZone NSZone; #if !defined(SWIFT_CLASS) # if defined(__has_attribute) && __has_attribute(objc_subclassing_restricted) # define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_CLASS_EXTRA +# define SWIFT_CLASS_NAMED(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA # else # define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA +# define SWIFT_CLASS_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA # endif #endif #if !defined(SWIFT_PROTOCOL) # define SWIFT_PROTOCOL(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA +# define SWIFT_PROTOCOL_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA #endif #if !defined(SWIFT_EXTENSION) @@ -68,23 +76,19 @@ typedef struct _NSZone NSZone; #if !defined(SWIFT_ENUM) # define SWIFT_ENUM(_type, _name) enum _name : _type _name; enum SWIFT_ENUM_EXTRA _name : _type #endif -#if __has_feature(nullability) -# define SWIFT_NULLABILITY(X) X -#else -# if !defined(__nonnull) -# define __nonnull -# endif -# if !defined(__nullable) -# define __nullable -# endif -# if !defined(__null_unspecified) -# define __null_unspecified -# endif -# define SWIFT_NULLABILITY(X) -#endif +typedef float swift_float2 __attribute__((__ext_vector_type__(2))); +typedef float swift_float3 __attribute__((__ext_vector_type__(3))); +typedef float swift_float4 __attribute__((__ext_vector_type__(4))); +typedef double swift_double2 __attribute__((__ext_vector_type__(2))); +typedef double swift_double3 __attribute__((__ext_vector_type__(3))); +typedef double swift_double4 __attribute__((__ext_vector_type__(4))); +typedef int swift_int2 __attribute__((__ext_vector_type__(2))); +typedef int swift_int3 __attribute__((__ext_vector_type__(3))); +typedef int swift_int4 __attribute__((__ext_vector_type__(4))); #if defined(__has_feature) && __has_feature(modules) @import Foundation; @import Foundation.NSURLSession; +@import ObjectiveC; #endif #pragma clang diagnostic ignored "-Wproperty-attribute-mismatch" @@ -99,9 +103,10 @@ typedef struct _NSZone NSZone; @property (nonatomic, readonly, copy) NSString * __nonnull URLString; @end +@class NSMutableURLRequest; @interface NSURLRequest (SWIFT_EXTENSION(Alamofire)) -@property (nonatomic, readonly) NSURLRequest * __nonnull URLRequest; +@property (nonatomic, readonly) NSMutableURLRequest * __nonnull URLRequest; @end @@ -113,4 +118,284 @@ typedef struct _NSZone NSZone; @interface NSURLSession (SWIFT_EXTENSION(Alamofire)) @end +@class NSURLSessionTask; +@class TaskDelegate; +@class NSError; +@class NSURLAuthenticationChallenge; +@class NSURLCredential; +@class NSHTTPURLResponse; +@class NSInputStream; +@class NSURLSessionDataTask; +@class NSURLResponse; +@class NSURLSessionDownloadTask; +@class NSData; +@class NSCachedURLResponse; + + +/// Responsible for handling all delegate callbacks for the underlying session. +SWIFT_CLASS("_TtCC9Alamofire7Manager15SessionDelegate") +@interface SessionDelegate : NSObject +- (TaskDelegate * __nullable)objectForKeyedSubscript:(NSURLSessionTask * __nonnull)task; +- (void)setObject:(TaskDelegate * __nullable)newValue forKeyedSubscript:(NSURLSessionTask * __nonnull)task; + +/// Overrides default behavior for NSURLSessionDelegate method URLSession:didBecomeInvalidWithError:. +@property (nonatomic, copy) void (^ __nullable sessionDidBecomeInvalidWithError)(NSURLSession * __nonnull, NSError * __nullable); + +/// Overrides default behavior for NSURLSessionDelegate method URLSessionDidFinishEventsForBackgroundURLSession:. +@property (nonatomic, copy) void (^ __nullable sessionDidFinishEventsForBackgroundURLSession)(NSURLSession * __nonnull); + +/// Tells the delegate that the session has been invalidated. +/// +/// \param session The session object that was invalidated. +/// +/// \param error The error that caused invalidation, or nil if the invalidation was explicit. +- (void)URLSession:(NSURLSession * __nonnull)session didBecomeInvalidWithError:(NSError * __nullable)error; + +/// Requests credentials from the delegate in response to a session-level authentication request from the remote server. +/// +/// \param session The session containing the task that requested authentication. +/// +/// \param challenge An object that contains the request for authentication. +/// +/// \param completionHandler A handler that your delegate method must call providing the disposition and credential. +- (void)URLSession:(NSURLSession * __nonnull)session didReceiveChallenge:(NSURLAuthenticationChallenge * __nonnull)challenge completionHandler:(void (^ __nonnull)(NSURLSessionAuthChallengeDisposition, NSURLCredential * __nullable))completionHandler; + +/// Tells the delegate that all messages enqueued for a session have been delivered. +/// +/// \param session The session that no longer has any outstanding requests. +- (void)URLSessionDidFinishEventsForBackgroundURLSession:(NSURLSession * __nonnull)session; + +/// Overrides default behavior for NSURLSessionTaskDelegate method URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:. +@property (nonatomic, copy) NSURLRequest * __nullable (^ __nullable taskWillPerformHTTPRedirection)(NSURLSession * __nonnull, NSURLSessionTask * __nonnull, NSHTTPURLResponse * __nonnull, NSURLRequest * __nonnull); + +/// Overrides default behavior for NSURLSessionTaskDelegate method URLSession:session:task:needNewBodyStream:. +@property (nonatomic, copy) NSInputStream * __null_unspecified (^ __nullable taskNeedNewBodyStream)(NSURLSession * __nonnull, NSURLSessionTask * __nonnull); + +/// Overrides default behavior for NSURLSessionTaskDelegate method URLSession:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:. +@property (nonatomic, copy) void (^ __nullable taskDidSendBodyData)(NSURLSession * __nonnull, NSURLSessionTask * __nonnull, int64_t, int64_t, int64_t); + +/// Overrides default behavior for NSURLSessionTaskDelegate method URLSession:task:didCompleteWithError:. +@property (nonatomic, copy) void (^ __nullable taskDidComplete)(NSURLSession * __nonnull, NSURLSessionTask * __nonnull, NSError * __nullable); + +/// Tells the delegate that the remote server requested an HTTP redirect. +/// +/// \param session The session containing the task whose request resulted in a redirect. +/// +/// \param task The task whose request resulted in a redirect. +/// +/// \param response An object containing the server’s response to the original request. +/// +/// \param request A URL request object filled out with the new location. +/// +/// \param completionHandler A closure that your handler should call with either the value of the request +/// parameter, a modified URL request object, or NULL to refuse the redirect and +/// return the body of the redirect response. +- (void)URLSession:(NSURLSession * __nonnull)session task:(NSURLSessionTask * __nonnull)task willPerformHTTPRedirection:(NSHTTPURLResponse * __nonnull)response newRequest:(NSURLRequest * __nonnull)request completionHandler:(void (^ __nonnull)(NSURLRequest * __nullable))completionHandler; + +/// Requests credentials from the delegate in response to an authentication request from the remote server. +/// +/// \param session The session containing the task whose request requires authentication. +/// +/// \param task The task whose request requires authentication. +/// +/// \param challenge An object that contains the request for authentication. +/// +/// \param completionHandler A handler that your delegate method must call providing the disposition and credential. +- (void)URLSession:(NSURLSession * __nonnull)session task:(NSURLSessionTask * __nonnull)task didReceiveChallenge:(NSURLAuthenticationChallenge * __nonnull)challenge completionHandler:(void (^ __nonnull)(NSURLSessionAuthChallengeDisposition, NSURLCredential * __nullable))completionHandler; + +/// Tells the delegate when a task requires a new request body stream to send to the remote server. +/// +/// \param session The session containing the task that needs a new body stream. +/// +/// \param task The task that needs a new body stream. +/// +/// \param completionHandler A completion handler that your delegate method should call with the new body stream. +- (void)URLSession:(NSURLSession * __nonnull)session task:(NSURLSessionTask * __nonnull)task needNewBodyStream:(void (^ __nonnull)(NSInputStream * __nullable))completionHandler; + +/// Periodically informs the delegate of the progress of sending body content to the server. +/// +/// \param session The session containing the data task. +/// +/// \param task The data task. +/// +/// \param bytesSent The number of bytes sent since the last time this delegate method was called. +/// +/// \param totalBytesSent The total number of bytes sent so far. +/// +/// \param totalBytesExpectedToSend The expected length of the body data. +- (void)URLSession:(NSURLSession * __nonnull)session task:(NSURLSessionTask * __nonnull)task didSendBodyData:(int64_t)bytesSent totalBytesSent:(int64_t)totalBytesSent totalBytesExpectedToSend:(int64_t)totalBytesExpectedToSend; + +/// Tells the delegate that the task finished transferring data. +/// +/// \param session The session containing the task whose request finished transferring data. +/// +/// \param task The task whose request finished transferring data. +/// +/// \param error If an error occurred, an error object indicating how the transfer failed, otherwise nil. +- (void)URLSession:(NSURLSession * __nonnull)session task:(NSURLSessionTask * __nonnull)task didCompleteWithError:(NSError * __nullable)error; + +/// Overrides default behavior for NSURLSessionDataDelegate method URLSession:dataTask:didReceiveResponse:completionHandler:. +@property (nonatomic, copy) NSURLSessionResponseDisposition (^ __nullable dataTaskDidReceiveResponse)(NSURLSession * __nonnull, NSURLSessionDataTask * __nonnull, NSURLResponse * __nonnull); + +/// Overrides default behavior for NSURLSessionDataDelegate method URLSession:dataTask:didBecomeDownloadTask:. +@property (nonatomic, copy) void (^ __nullable dataTaskDidBecomeDownloadTask)(NSURLSession * __nonnull, NSURLSessionDataTask * __nonnull, NSURLSessionDownloadTask * __nonnull); + +/// Overrides default behavior for NSURLSessionDataDelegate method URLSession:dataTask:didReceiveData:. +@property (nonatomic, copy) void (^ __nullable dataTaskDidReceiveData)(NSURLSession * __nonnull, NSURLSessionDataTask * __nonnull, NSData * __nonnull); + +/// Overrides default behavior for NSURLSessionDataDelegate method URLSession:dataTask:willCacheResponse:completionHandler:. +@property (nonatomic, copy) NSCachedURLResponse * __null_unspecified (^ __nullable dataTaskWillCacheResponse)(NSURLSession * __nonnull, NSURLSessionDataTask * __nonnull, NSCachedURLResponse * __nonnull); + +/// Tells the delegate that the data task received the initial reply (headers) from the server. +/// +/// \param session The session containing the data task that received an initial reply. +/// +/// \param dataTask The data task that received an initial reply. +/// +/// \param response A URL response object populated with headers. +/// +/// \param completionHandler A completion handler that your code calls to continue the transfer, passing a +/// constant to indicate whether the transfer should continue as a data task or +/// should become a download task. +- (void)URLSession:(NSURLSession * __nonnull)session dataTask:(NSURLSessionDataTask * __nonnull)dataTask didReceiveResponse:(NSURLResponse * __nonnull)response completionHandler:(void (^ __nonnull)(NSURLSessionResponseDisposition))completionHandler; + +/// Tells the delegate that the data task was changed to a download task. +/// +/// \param session The session containing the task that was replaced by a download task. +/// +/// \param dataTask The data task that was replaced by a download task. +/// +/// \param downloadTask The new download task that replaced the data task. +- (void)URLSession:(NSURLSession * __nonnull)session dataTask:(NSURLSessionDataTask * __nonnull)dataTask didBecomeDownloadTask:(NSURLSessionDownloadTask * __nonnull)downloadTask; + +/// Tells the delegate that the data task has received some of the expected data. +/// +/// \param session The session containing the data task that provided data. +/// +/// \param dataTask The data task that provided data. +/// +/// \param data A data object containing the transferred data. +- (void)URLSession:(NSURLSession * __nonnull)session dataTask:(NSURLSessionDataTask * __nonnull)dataTask didReceiveData:(NSData * __nonnull)data; + +/// Asks the delegate whether the data (or upload) task should store the response in the cache. +/// +/// \param session The session containing the data (or upload) task. +/// +/// \param dataTask The data (or upload) task. +/// +/// \param proposedResponse The default caching behavior. This behavior is determined based on the current +/// caching policy and the values of certain received headers, such as the Pragma +/// and Cache-Control headers. +/// +/// \param completionHandler A block that your handler must call, providing either the original proposed +/// response, a modified version of that response, or NULL to prevent caching the +/// response. If your delegate implements this method, it must call this completion +/// handler; otherwise, your app leaks memory. +- (void)URLSession:(NSURLSession * __nonnull)session dataTask:(NSURLSessionDataTask * __nonnull)dataTask willCacheResponse:(NSCachedURLResponse * __nonnull)proposedResponse completionHandler:(void (^ __nonnull)(NSCachedURLResponse * __nullable))completionHandler; + +/// Overrides default behavior for NSURLSessionDownloadDelegate method URLSession:downloadTask:didFinishDownloadingToURL:. +@property (nonatomic, copy) void (^ __nullable downloadTaskDidFinishDownloadingToURL)(NSURLSession * __nonnull, NSURLSessionDownloadTask * __nonnull, NSURL * __nonnull); + +/// Overrides default behavior for NSURLSessionDownloadDelegate method URLSession:downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:. +@property (nonatomic, copy) void (^ __nullable downloadTaskDidWriteData)(NSURLSession * __nonnull, NSURLSessionDownloadTask * __nonnull, int64_t, int64_t, int64_t); + +/// Overrides default behavior for NSURLSessionDownloadDelegate method URLSession:downloadTask:didResumeAtOffset:expectedTotalBytes:. +@property (nonatomic, copy) void (^ __nullable downloadTaskDidResumeAtOffset)(NSURLSession * __nonnull, NSURLSessionDownloadTask * __nonnull, int64_t, int64_t); + +/// Tells the delegate that a download task has finished downloading. +/// +/// \param session The session containing the download task that finished. +/// +/// \param downloadTask The download task that finished. +/// +/// \param location A file URL for the temporary file. Because the file is temporary, you must either +/// open the file for reading or move it to a permanent location in your app’s sandbox +/// container directory before returning from this delegate method. +- (void)URLSession:(NSURLSession * __nonnull)session downloadTask:(NSURLSessionDownloadTask * __nonnull)downloadTask didFinishDownloadingToURL:(NSURL * __nonnull)location; + +/// Periodically informs the delegate about the download’s progress. +/// +/// \param session The session containing the download task. +/// +/// \param downloadTask The download task. +/// +/// \param bytesWritten The number of bytes transferred since the last time this delegate +/// method was called. +/// +/// \param totalBytesWritten The total number of bytes transferred so far. +/// +/// \param totalBytesExpectedToWrite The expected length of the file, as provided by the Content-Length +/// header. If this header was not provided, the value is +/// NSURLSessionTransferSizeUnknown +/// . +- (void)URLSession:(NSURLSession * __nonnull)session downloadTask:(NSURLSessionDownloadTask * __nonnull)downloadTask didWriteData:(int64_t)bytesWritten totalBytesWritten:(int64_t)totalBytesWritten totalBytesExpectedToWrite:(int64_t)totalBytesExpectedToWrite; + +/// Tells the delegate that the download task has resumed downloading. +/// +/// \param session The session containing the download task that finished. +/// +/// \param downloadTask The download task that resumed. See explanation in the discussion. +/// +/// \param fileOffset If the file's cache policy or last modified date prevents reuse of the +/// existing content, then this value is zero. Otherwise, this value is an +/// integer representing the number of bytes on disk that do not need to be +/// retrieved again. +/// +/// \param expectedTotalBytes The expected length of the file, as provided by the Content-Length header. +/// If this header was not provided, the value is NSURLSessionTransferSizeUnknown. +- (void)URLSession:(NSURLSession * __nonnull)session downloadTask:(NSURLSessionDownloadTask * __nonnull)downloadTask didResumeAtOffset:(int64_t)fileOffset expectedTotalBytes:(int64_t)expectedTotalBytes; +- (BOOL)respondsToSelector:(SEL __null_unspecified)selector; +- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER; +@end + +@class NSURLSessionStreamTask; +@class NSOutputStream; + +@interface SessionDelegate (SWIFT_EXTENSION(Alamofire)) + +/// Overrides default behavior for NSURLSessionStreamDelegate method URLSession:readClosedForStreamTask:. +@property (nonatomic, copy) void (^ __nullable streamTaskReadClosed)(NSURLSession * __nonnull, NSURLSessionStreamTask * __nonnull); + +/// Overrides default behavior for NSURLSessionStreamDelegate method URLSession:writeClosedForStreamTask:. +@property (nonatomic, copy) void (^ __nullable streamTaskWriteClosed)(NSURLSession * __nonnull, NSURLSessionStreamTask * __nonnull); + +/// Overrides default behavior for NSURLSessionStreamDelegate method URLSession:betterRouteDiscoveredForStreamTask:. +@property (nonatomic, copy) void (^ __nullable streamTaskBetterRouteDiscovered)(NSURLSession * __nonnull, NSURLSessionStreamTask * __nonnull); + +/// Overrides default behavior for NSURLSessionStreamDelegate method URLSession:streamTask:didBecomeInputStream:outputStream:. +@property (nonatomic, copy) void (^ __nullable streamTaskDidBecomeInputStream)(NSURLSession * __nonnull, NSURLSessionStreamTask * __nonnull, NSInputStream * __nonnull, NSOutputStream * __nonnull); + +/// Tells the delegate that the read side of the connection has been closed. +/// +/// \param session The session. +/// +/// \param streamTask The stream task. +- (void)URLSession:(NSURLSession * __nonnull)session readClosedForStreamTask:(NSURLSessionStreamTask * __nonnull)streamTask; + +/// Tells the delegate that the write side of the connection has been closed. +/// +/// \param session The session. +/// +/// \param streamTask The stream task. +- (void)URLSession:(NSURLSession * __nonnull)session writeClosedForStreamTask:(NSURLSessionStreamTask * __nonnull)streamTask; + +/// Tells the delegate that the system has determined that a better route to the host is available. +/// +/// \param session The session. +/// +/// \param streamTask The stream task. +- (void)URLSession:(NSURLSession * __nonnull)session betterRouteDiscoveredForStreamTask:(NSURLSessionStreamTask * __nonnull)streamTask; + +/// Tells the delegate that the stream task has been completed and provides the unopened stream objects. +/// +/// \param session The session. +/// +/// \param streamTask The stream task. +/// +/// \param inputStream The new input stream. +/// +/// \param outputStream The new output stream. +- (void)URLSession:(NSURLSession * __nonnull)session streamTask:(NSURLSessionStreamTask * __nonnull)streamTask didBecomeInputStream:(NSInputStream * __nonnull)inputStream outputStream:(NSOutputStream * __nonnull)outputStream; +@end + #pragma clang diagnostic pop diff --git a/Carthage/Build/Mac/Alamofire.framework/Versions/A/Modules/Alamofire.swiftmodule/x86_64.swiftdoc b/Carthage/Build/Mac/Alamofire.framework/Versions/A/Modules/Alamofire.swiftmodule/x86_64.swiftdoc index 8b86de4..fcfbddd 100644 Binary files a/Carthage/Build/Mac/Alamofire.framework/Versions/A/Modules/Alamofire.swiftmodule/x86_64.swiftdoc and b/Carthage/Build/Mac/Alamofire.framework/Versions/A/Modules/Alamofire.swiftmodule/x86_64.swiftdoc differ diff --git a/Carthage/Build/Mac/Alamofire.framework/Versions/A/Modules/Alamofire.swiftmodule/x86_64.swiftmodule b/Carthage/Build/Mac/Alamofire.framework/Versions/A/Modules/Alamofire.swiftmodule/x86_64.swiftmodule index 2f05130..102fded 100644 Binary files a/Carthage/Build/Mac/Alamofire.framework/Versions/A/Modules/Alamofire.swiftmodule/x86_64.swiftmodule and b/Carthage/Build/Mac/Alamofire.framework/Versions/A/Modules/Alamofire.swiftmodule/x86_64.swiftmodule differ diff --git a/Carthage/Build/Mac/Alamofire.framework/Versions/A/Resources/Info.plist b/Carthage/Build/Mac/Alamofire.framework/Versions/A/Resources/Info.plist index a5f36ef..dce1b20 100644 --- a/Carthage/Build/Mac/Alamofire.framework/Versions/A/Resources/Info.plist +++ b/Carthage/Build/Mac/Alamofire.framework/Versions/A/Resources/Info.plist @@ -3,7 +3,7 @@ BuildMachineOSBuild - 14E46 + 14F27 CFBundleDevelopmentRegion en CFBundleExecutable @@ -17,25 +17,29 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 1.3.1 + 2.0.2 CFBundleSignature ???? + CFBundleSupportedPlatforms + + MacOSX + CFBundleVersion 1 DTCompiler com.apple.compilers.llvm.clang.1_0 DTPlatformBuild - 6E35b + 7A220 DTPlatformVersion GM DTSDKBuild - 14D125 + 15A278 DTSDKName - macosx10.10 + macosx10.11 DTXcode - 0640 + 0700 DTXcodeBuild - 6E35b + 7A220 UIDeviceFamily 1 diff --git a/Carthage/Build/Mac/BurntCocoaUI.framework/Versions/A/BurntCocoaUI b/Carthage/Build/Mac/BurntCocoaUI.framework/Versions/A/BurntCocoaUI index ec0e9a1..da4cef6 100755 Binary files a/Carthage/Build/Mac/BurntCocoaUI.framework/Versions/A/BurntCocoaUI and b/Carthage/Build/Mac/BurntCocoaUI.framework/Versions/A/BurntCocoaUI differ diff --git a/Carthage/Build/Mac/BurntCocoaUI.framework/Versions/A/Headers/BurntCocoaUI-Swift.h b/Carthage/Build/Mac/BurntCocoaUI.framework/Versions/A/Headers/BurntCocoaUI-Swift.h index 66932cb..abb3f70 100644 --- a/Carthage/Build/Mac/BurntCocoaUI.framework/Versions/A/Headers/BurntCocoaUI-Swift.h +++ b/Carthage/Build/Mac/BurntCocoaUI.framework/Versions/A/Headers/BurntCocoaUI-Swift.h @@ -1,4 +1,4 @@ -// Generated by Apple Swift version 1.2 (swiftlang-602.0.53.1 clang-602.0.53) +// Generated by Apple Swift version 2.0 (swiftlang-700.0.59 clang-700.0.72) #pragma clang diagnostic push #if defined(__has_include) && __has_include() @@ -33,6 +33,11 @@ typedef struct _NSZone NSZone; #else # define SWIFT_RUNTIME_NAME(X) #endif +#if defined(__has_attribute) && __has_attribute(swift_name) +# define SWIFT_COMPILE_NAME(X) __attribute__((swift_name(X))) +#else +# define SWIFT_COMPILE_NAME(X) +#endif #if !defined(SWIFT_CLASS_EXTRA) # define SWIFT_CLASS_EXTRA #endif @@ -45,13 +50,16 @@ typedef struct _NSZone NSZone; #if !defined(SWIFT_CLASS) # if defined(__has_attribute) && __has_attribute(objc_subclassing_restricted) # define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_CLASS_EXTRA +# define SWIFT_CLASS_NAMED(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA # else # define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA +# define SWIFT_CLASS_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA # endif #endif #if !defined(SWIFT_PROTOCOL) # define SWIFT_PROTOCOL(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA +# define SWIFT_PROTOCOL_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA #endif #if !defined(SWIFT_EXTENSION) @@ -68,23 +76,23 @@ typedef struct _NSZone NSZone; #if !defined(SWIFT_ENUM) # define SWIFT_ENUM(_type, _name) enum _name : _type _name; enum SWIFT_ENUM_EXTRA _name : _type #endif -#if __has_feature(nullability) -# define SWIFT_NULLABILITY(X) X -#else -# if !defined(__nonnull) -# define __nonnull -# endif -# if !defined(__nullable) -# define __nullable -# endif -# if !defined(__null_unspecified) -# define __null_unspecified -# endif -# define SWIFT_NULLABILITY(X) -#endif +typedef float swift_float2 __attribute__((__ext_vector_type__(2))); +typedef float swift_float3 __attribute__((__ext_vector_type__(3))); +typedef float swift_float4 __attribute__((__ext_vector_type__(4))); +typedef double swift_double2 __attribute__((__ext_vector_type__(2))); +typedef double swift_double3 __attribute__((__ext_vector_type__(3))); +typedef double swift_double4 __attribute__((__ext_vector_type__(4))); +typedef int swift_int2 __attribute__((__ext_vector_type__(2))); +typedef int swift_int3 __attribute__((__ext_vector_type__(3))); +typedef int swift_int4 __attribute__((__ext_vector_type__(4))); #if defined(__has_feature) && __has_feature(modules) +@import AppKit; #endif #pragma clang diagnostic ignored "-Wproperty-attribute-mismatch" #pragma clang diagnostic ignored "-Wduplicate-method-arg" + +@interface NSEvent (SWIFT_EXTENSION(BurntCocoaUI)) +@end + #pragma clang diagnostic pop diff --git a/Carthage/Build/Mac/BurntCocoaUI.framework/Versions/A/Modules/BurntCocoaUI.swiftmodule/x86_64.swiftdoc b/Carthage/Build/Mac/BurntCocoaUI.framework/Versions/A/Modules/BurntCocoaUI.swiftmodule/x86_64.swiftdoc index a829c1a..cb6ee6a 100644 Binary files a/Carthage/Build/Mac/BurntCocoaUI.framework/Versions/A/Modules/BurntCocoaUI.swiftmodule/x86_64.swiftdoc and b/Carthage/Build/Mac/BurntCocoaUI.framework/Versions/A/Modules/BurntCocoaUI.swiftmodule/x86_64.swiftdoc differ diff --git a/Carthage/Build/Mac/BurntCocoaUI.framework/Versions/A/Modules/BurntCocoaUI.swiftmodule/x86_64.swiftmodule b/Carthage/Build/Mac/BurntCocoaUI.framework/Versions/A/Modules/BurntCocoaUI.swiftmodule/x86_64.swiftmodule index e5de18f..71a3bc3 100644 Binary files a/Carthage/Build/Mac/BurntCocoaUI.framework/Versions/A/Modules/BurntCocoaUI.swiftmodule/x86_64.swiftmodule and b/Carthage/Build/Mac/BurntCocoaUI.framework/Versions/A/Modules/BurntCocoaUI.swiftmodule/x86_64.swiftmodule differ diff --git a/Carthage/Build/Mac/BurntCocoaUI.framework/Versions/A/Resources/Info.plist b/Carthage/Build/Mac/BurntCocoaUI.framework/Versions/A/Resources/Info.plist index bbd3cbe..149e130 100644 --- a/Carthage/Build/Mac/BurntCocoaUI.framework/Versions/A/Resources/Info.plist +++ b/Carthage/Build/Mac/BurntCocoaUI.framework/Versions/A/Resources/Info.plist @@ -3,7 +3,7 @@ BuildMachineOSBuild - 14E46 + 14F27 CFBundleDevelopmentRegion en CFBundleExecutable @@ -20,22 +20,26 @@ 0.2 CFBundleSignature ???? + CFBundleSupportedPlatforms + + MacOSX + CFBundleVersion 1 DTCompiler com.apple.compilers.llvm.clang.1_0 DTPlatformBuild - 6E35b + 7A220 DTPlatformVersion GM DTSDKBuild - 14D125 + 15A278 DTSDKName - macosx10.10 + macosx10.11 DTXcode - 0640 + 0700 DTXcodeBuild - 6E35b + 7A220 NSHumanReadableCopyright Copyright © 2015 Burnt Caramel. All rights reserved. diff --git a/Carthage/Build/Mac/BurntFoundation.framework/Versions/A/BurntFoundation b/Carthage/Build/Mac/BurntFoundation.framework/Versions/A/BurntFoundation index f2f45f4..35fcc28 100755 Binary files a/Carthage/Build/Mac/BurntFoundation.framework/Versions/A/BurntFoundation and b/Carthage/Build/Mac/BurntFoundation.framework/Versions/A/BurntFoundation differ diff --git a/Carthage/Build/Mac/BurntFoundation.framework/Versions/A/Headers/BurntFoundation-Swift.h b/Carthage/Build/Mac/BurntFoundation.framework/Versions/A/Headers/BurntFoundation-Swift.h index b884984..9b98b20 100644 --- a/Carthage/Build/Mac/BurntFoundation.framework/Versions/A/Headers/BurntFoundation-Swift.h +++ b/Carthage/Build/Mac/BurntFoundation.framework/Versions/A/Headers/BurntFoundation-Swift.h @@ -1,4 +1,4 @@ -// Generated by Apple Swift version 1.2 (swiftlang-602.0.53.1 clang-602.0.53) +// Generated by Apple Swift version 2.0 (swiftlang-700.0.59 clang-700.0.72) #pragma clang diagnostic push #if defined(__has_include) && __has_include() @@ -33,6 +33,11 @@ typedef struct _NSZone NSZone; #else # define SWIFT_RUNTIME_NAME(X) #endif +#if defined(__has_attribute) && __has_attribute(swift_name) +# define SWIFT_COMPILE_NAME(X) __attribute__((swift_name(X))) +#else +# define SWIFT_COMPILE_NAME(X) +#endif #if !defined(SWIFT_CLASS_EXTRA) # define SWIFT_CLASS_EXTRA #endif @@ -45,13 +50,16 @@ typedef struct _NSZone NSZone; #if !defined(SWIFT_CLASS) # if defined(__has_attribute) && __has_attribute(objc_subclassing_restricted) # define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_CLASS_EXTRA +# define SWIFT_CLASS_NAMED(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA # else # define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA +# define SWIFT_CLASS_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA # endif #endif #if !defined(SWIFT_PROTOCOL) # define SWIFT_PROTOCOL(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA +# define SWIFT_PROTOCOL_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA #endif #if !defined(SWIFT_EXTENSION) @@ -68,20 +76,15 @@ typedef struct _NSZone NSZone; #if !defined(SWIFT_ENUM) # define SWIFT_ENUM(_type, _name) enum _name : _type _name; enum SWIFT_ENUM_EXTRA _name : _type #endif -#if __has_feature(nullability) -# define SWIFT_NULLABILITY(X) X -#else -# if !defined(__nonnull) -# define __nonnull -# endif -# if !defined(__nullable) -# define __nullable -# endif -# if !defined(__null_unspecified) -# define __null_unspecified -# endif -# define SWIFT_NULLABILITY(X) -#endif +typedef float swift_float2 __attribute__((__ext_vector_type__(2))); +typedef float swift_float3 __attribute__((__ext_vector_type__(3))); +typedef float swift_float4 __attribute__((__ext_vector_type__(4))); +typedef double swift_double2 __attribute__((__ext_vector_type__(2))); +typedef double swift_double3 __attribute__((__ext_vector_type__(3))); +typedef double swift_double4 __attribute__((__ext_vector_type__(4))); +typedef int swift_int2 __attribute__((__ext_vector_type__(2))); +typedef int swift_int3 __attribute__((__ext_vector_type__(3))); +typedef int swift_int4 __attribute__((__ext_vector_type__(4))); #if defined(__has_feature) && __has_feature(modules) @import Foundation; #endif diff --git a/Carthage/Build/Mac/BurntFoundation.framework/Versions/A/Modules/BurntFoundation.swiftmodule/x86_64.swiftdoc b/Carthage/Build/Mac/BurntFoundation.framework/Versions/A/Modules/BurntFoundation.swiftmodule/x86_64.swiftdoc index dab76ce..26687c9 100644 Binary files a/Carthage/Build/Mac/BurntFoundation.framework/Versions/A/Modules/BurntFoundation.swiftmodule/x86_64.swiftdoc and b/Carthage/Build/Mac/BurntFoundation.framework/Versions/A/Modules/BurntFoundation.swiftmodule/x86_64.swiftdoc differ diff --git a/Carthage/Build/Mac/BurntFoundation.framework/Versions/A/Modules/BurntFoundation.swiftmodule/x86_64.swiftmodule b/Carthage/Build/Mac/BurntFoundation.framework/Versions/A/Modules/BurntFoundation.swiftmodule/x86_64.swiftmodule index d5f2a56..7f9837c 100644 Binary files a/Carthage/Build/Mac/BurntFoundation.framework/Versions/A/Modules/BurntFoundation.swiftmodule/x86_64.swiftmodule and b/Carthage/Build/Mac/BurntFoundation.framework/Versions/A/Modules/BurntFoundation.swiftmodule/x86_64.swiftmodule differ diff --git a/Carthage/Build/Mac/BurntFoundation.framework/Versions/A/Resources/Info.plist b/Carthage/Build/Mac/BurntFoundation.framework/Versions/A/Resources/Info.plist index 3be6b9a..b6e9ee0 100644 --- a/Carthage/Build/Mac/BurntFoundation.framework/Versions/A/Resources/Info.plist +++ b/Carthage/Build/Mac/BurntFoundation.framework/Versions/A/Resources/Info.plist @@ -3,7 +3,7 @@ BuildMachineOSBuild - 14E46 + 14F27 CFBundleDevelopmentRegion en CFBundleExecutable @@ -20,22 +20,26 @@ 1.0 CFBundleSignature ???? + CFBundleSupportedPlatforms + + MacOSX + CFBundleVersion 1 DTCompiler com.apple.compilers.llvm.clang.1_0 DTPlatformBuild - 6E35b + 7A220 DTPlatformVersion GM DTSDKBuild - 14D125 + 15A278 DTSDKName - macosx10.10 + macosx10.11 DTXcode - 0640 + 0700 DTXcodeBuild - 6E35b + 7A220 NSHumanReadableCopyright Copyright © 2015 Burnt Caramel. All rights reserved. diff --git a/Carthage/Build/Mac/BurntList.framework/Versions/A/BurntList b/Carthage/Build/Mac/BurntList.framework/Versions/A/BurntList index fe1afea..766de7d 100755 Binary files a/Carthage/Build/Mac/BurntList.framework/Versions/A/BurntList and b/Carthage/Build/Mac/BurntList.framework/Versions/A/BurntList differ diff --git a/Carthage/Build/Mac/BurntList.framework/Versions/A/Headers/BurntList-Swift.h b/Carthage/Build/Mac/BurntList.framework/Versions/A/Headers/BurntList-Swift.h index 66932cb..fceeae8 100644 --- a/Carthage/Build/Mac/BurntList.framework/Versions/A/Headers/BurntList-Swift.h +++ b/Carthage/Build/Mac/BurntList.framework/Versions/A/Headers/BurntList-Swift.h @@ -1,4 +1,4 @@ -// Generated by Apple Swift version 1.2 (swiftlang-602.0.53.1 clang-602.0.53) +// Generated by Apple Swift version 2.0 (swiftlang-700.0.59 clang-700.0.72) #pragma clang diagnostic push #if defined(__has_include) && __has_include() @@ -33,6 +33,11 @@ typedef struct _NSZone NSZone; #else # define SWIFT_RUNTIME_NAME(X) #endif +#if defined(__has_attribute) && __has_attribute(swift_name) +# define SWIFT_COMPILE_NAME(X) __attribute__((swift_name(X))) +#else +# define SWIFT_COMPILE_NAME(X) +#endif #if !defined(SWIFT_CLASS_EXTRA) # define SWIFT_CLASS_EXTRA #endif @@ -45,13 +50,16 @@ typedef struct _NSZone NSZone; #if !defined(SWIFT_CLASS) # if defined(__has_attribute) && __has_attribute(objc_subclassing_restricted) # define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_CLASS_EXTRA +# define SWIFT_CLASS_NAMED(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA # else # define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA +# define SWIFT_CLASS_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA # endif #endif #if !defined(SWIFT_PROTOCOL) # define SWIFT_PROTOCOL(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA +# define SWIFT_PROTOCOL_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA #endif #if !defined(SWIFT_EXTENSION) @@ -68,20 +76,15 @@ typedef struct _NSZone NSZone; #if !defined(SWIFT_ENUM) # define SWIFT_ENUM(_type, _name) enum _name : _type _name; enum SWIFT_ENUM_EXTRA _name : _type #endif -#if __has_feature(nullability) -# define SWIFT_NULLABILITY(X) X -#else -# if !defined(__nonnull) -# define __nonnull -# endif -# if !defined(__nullable) -# define __nullable -# endif -# if !defined(__null_unspecified) -# define __null_unspecified -# endif -# define SWIFT_NULLABILITY(X) -#endif +typedef float swift_float2 __attribute__((__ext_vector_type__(2))); +typedef float swift_float3 __attribute__((__ext_vector_type__(3))); +typedef float swift_float4 __attribute__((__ext_vector_type__(4))); +typedef double swift_double2 __attribute__((__ext_vector_type__(2))); +typedef double swift_double3 __attribute__((__ext_vector_type__(3))); +typedef double swift_double4 __attribute__((__ext_vector_type__(4))); +typedef int swift_int2 __attribute__((__ext_vector_type__(2))); +typedef int swift_int3 __attribute__((__ext_vector_type__(3))); +typedef int swift_int4 __attribute__((__ext_vector_type__(4))); #if defined(__has_feature) && __has_feature(modules) #endif diff --git a/Carthage/Build/Mac/BurntList.framework/Versions/A/Modules/BurntList.swiftmodule/x86_64.swiftdoc b/Carthage/Build/Mac/BurntList.framework/Versions/A/Modules/BurntList.swiftmodule/x86_64.swiftdoc index 2ce4ff7..c1c7767 100644 Binary files a/Carthage/Build/Mac/BurntList.framework/Versions/A/Modules/BurntList.swiftmodule/x86_64.swiftdoc and b/Carthage/Build/Mac/BurntList.framework/Versions/A/Modules/BurntList.swiftmodule/x86_64.swiftdoc differ diff --git a/Carthage/Build/Mac/BurntList.framework/Versions/A/Modules/BurntList.swiftmodule/x86_64.swiftmodule b/Carthage/Build/Mac/BurntList.framework/Versions/A/Modules/BurntList.swiftmodule/x86_64.swiftmodule index e7af7b5..eb8823a 100644 Binary files a/Carthage/Build/Mac/BurntList.framework/Versions/A/Modules/BurntList.swiftmodule/x86_64.swiftmodule and b/Carthage/Build/Mac/BurntList.framework/Versions/A/Modules/BurntList.swiftmodule/x86_64.swiftmodule differ diff --git a/Carthage/Build/Mac/BurntList.framework/Versions/A/Resources/Info.plist b/Carthage/Build/Mac/BurntList.framework/Versions/A/Resources/Info.plist index ef5992d..06bcff0 100644 --- a/Carthage/Build/Mac/BurntList.framework/Versions/A/Resources/Info.plist +++ b/Carthage/Build/Mac/BurntList.framework/Versions/A/Resources/Info.plist @@ -3,7 +3,7 @@ BuildMachineOSBuild - 14E46 + 14F27 CFBundleDevelopmentRegion en CFBundleExecutable @@ -20,21 +20,25 @@ 1.0 CFBundleSignature ???? + CFBundleSupportedPlatforms + + MacOSX + CFBundleVersion 1 DTCompiler com.apple.compilers.llvm.clang.1_0 DTPlatformBuild - 6E35b + 7A220 DTPlatformVersion GM DTSDKBuild - 14D125 + 15A278 DTSDKName - macosx10.10 + macosx10.11 DTXcode - 0640 + 0700 DTXcodeBuild - 6E35b + 7A220 diff --git a/Lantern.xcodeproj/project.pbxproj b/Lantern.xcodeproj/project.pbxproj index 8c6f7ce..55357f9 100644 --- a/Lantern.xcodeproj/project.pbxproj +++ b/Lantern.xcodeproj/project.pbxproj @@ -263,6 +263,7 @@ isa = PBXGroup; children = ( B2054D8F1AF4780500DC2C00 /* Lantern.entitlements */, + B2054D731AF477C700DC2C00 /* Images.xcassets */, B22B7D941AC6B9090026AEDB /* AppDelegate.swift */, B22B7D9A1AC6B9090026AEDB /* Main.storyboard */, B2E2693C1AE9E9200044BE04 /* MainView.storyboard */, @@ -290,7 +291,6 @@ B23E29E91AE73DF6009A94E5 /* console.js */, B22B7DB51AC6B98A0026AEDB /* Categories */, B22B7DB11AC6B9860026AEDB /* Lantern-Bridging-Header.h */, - B2054D731AF477C700DC2C00 /* Images.xcassets */, B2054D6D1AF477C700DC2C00 /* Supporting Files */, B2D39B081AF601C7003D6738 /* code-sign-frameworks.sh */, ); @@ -543,6 +543,8 @@ B22B7D871AC6B9090026AEDB /* Project object */ = { isa = PBXProject; attributes = { + LastSwiftMigration = 0700; + LastSwiftUpdateCheck = 0700; LastUpgradeCheck = 0640; ORGANIZATIONNAME = "Burnt Caramel"; TargetAttributes = { @@ -584,10 +586,10 @@ projectDirPath = ""; projectRoot = ""; targets = ( - B22425F21AC8F8B200809EF0 /* LanternModel */, - B22425FC1AC8F8B200809EF0 /* LanternModelTests */, B25033301AF5E5B0006A2AE7 /* Lantern */, B2054D7B1AF477C700DC2C00 /* LanternTests */, + B22425F21AC8F8B200809EF0 /* LanternModel */, + B22425FC1AC8F8B200809EF0 /* LanternModelTests */, ); }; /* End PBXProject section */ @@ -660,7 +662,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "if [ \"${CONFIGURATION}\" = \"Debug\" ] ; then\n exit 0\nfi\n\nLOCATION=\"${BUILT_PRODUCTS_DIR}\"/\"${FRAMEWORKS_FOLDER_PATH}\"\nIDENTITY=\"Mac Developer: Patrick Smith (9J837BGA64)\"\ncodesign --verbose --force --sign \"$IDENTITY\" \"$LOCATION/HoverlyticsModel.framework/Versions/A\"\ncodesign --verbose --force --sign \"$IDENTITY\" \"$LOCATION/HoverlyticsModel.framework/Versions/A/Frameworks/Alamofire.framework/Versions/A\"\ncodesign --verbose --force --sign \"$IDENTITY\" \"$LOCATION/HoverlyticsModel.framework/Versions/A/Frameworks/Ono.framework/Versions/A\""; + shellScript = "if [ \"${CONFIGURATION}\" = \"Debug\" ] ; then\n exit 0\nfi\n\nLOCATION=\"${BUILT_PRODUCTS_DIR}\"/\"${FRAMEWORKS_FOLDER_PATH}\"\nIDENTITY=\"Mac Developer: Patrick Smith (9J837BGA64)\"\ncodesign --verbose --force --sign \"$IDENTITY\" \"$LOCATION/LanternModel.framework/Versions/A\"\ncodesign --verbose --force --sign \"$IDENTITY\" \"$LOCATION/LanternModel.framework/Versions/A/Frameworks/Alamofire.framework/Versions/A\"\ncodesign --verbose --force --sign \"$IDENTITY\" \"$LOCATION/LanternModel.framework/Versions/A/Frameworks/Ono.framework/Versions/A\""; }; /* End PBXShellScriptBuildPhase section */ diff --git a/Lantern.xcodeproj/project.xcworkspace/xcshareddata/Lantern.xccheckout b/Lantern.xcodeproj/project.xcworkspace/xcshareddata/Lantern.xccheckout index a28e538..8512bbe 100644 --- a/Lantern.xcodeproj/project.xcworkspace/xcshareddata/Lantern.xccheckout +++ b/Lantern.xcodeproj/project.xcworkspace/xcshareddata/Lantern.xccheckout @@ -7,14 +7,14 @@ IDESourceControlProjectIdentifier 7C530460-06FB-4D0C-81F5-3318564DDC8B IDESourceControlProjectName - Lantern + project IDESourceControlProjectOriginsDictionary 2F4F68DFA0550A2C87C14C3AC2F3397F1F46A29B burntcaramel.git.beanstalkapp.com:/burntcaramel/hoverlytics-for-mac.git IDESourceControlProjectPath - Lantern.xcodeproj + Lantern.xcodeproj/project.xcworkspace IDESourceControlProjectRelativeInstallPathDictionary 2F4F68DFA0550A2C87C14C3AC2F3397F1F46A29B diff --git a/Lantern.xcodeproj/xcuserdata/pgwsmith.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/Lantern.xcodeproj/xcuserdata/pgwsmith.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist index b1e18d9..cbe97b8 100644 --- a/Lantern.xcodeproj/xcuserdata/pgwsmith.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/Lantern.xcodeproj/xcuserdata/pgwsmith.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -21,6 +21,17 @@ continueAfterRunningActions = "No" symbolName = "objc_exception_throw" moduleName = ""> + + + + diff --git a/Lantern/AppDelegate.swift b/Lantern/AppDelegate.swift index f6c1e47..df424f4 100644 --- a/Lantern/AppDelegate.swift +++ b/Lantern/AppDelegate.swift @@ -59,7 +59,7 @@ class AppDelegate: NSObject, NSApplicationDelegate { lazy var mainStoryboard: NSStoryboard = { - return NSStoryboard(name: "Main", bundle: nil)! + return NSStoryboard(name: "Main", bundle: nil) }() var mainWindowControllers = [MainWindowController]() @@ -73,7 +73,7 @@ class AppDelegate: NSObject, NSApplicationDelegate { let nc = NSNotificationCenter.defaultCenter() windowWillCloseObservers.append(nc.addObserverForName(NSWindowWillCloseNotification, object: windowController.window!, queue: nil, usingBlock: { [unowned self] note in - if let index = find(self.mainWindowControllers, windowController) { + if let index = self.mainWindowControllers.indexOf(windowController) { self.mainWindowControllers.removeAtIndex(index) } })) @@ -84,4 +84,9 @@ class AppDelegate: NSObject, NSApplicationDelegate { @IBAction func newDocument(sender: AnyObject?) { self.applicationOpenUntitledFile(NSApp) } + + @IBAction func forkOnGitHub(sender: AnyObject?) { + let URL = NSURL(string: "https://github.com/BurntCaramel/Lantern")! + NSWorkspace.sharedWorkspace().openURL(URL) + } } diff --git a/Lantern/Base.lproj/Main.storyboard b/Lantern/Base.lproj/Main.storyboard index bdc8b35..bfebd9b 100644 --- a/Lantern/Base.lproj/Main.storyboard +++ b/Lantern/Base.lproj/Main.storyboard @@ -1,7 +1,7 @@ - + - + @@ -20,6 +20,12 @@ + + + + + + @@ -385,7 +391,7 @@ - + @@ -398,7 +404,7 @@ - + @@ -491,7 +497,7 @@ - + diff --git a/Lantern/BrowserMenuController.swift b/Lantern/BrowserMenuController.swift index 0b6e3c7..f363e36 100644 --- a/Lantern/BrowserMenuController.swift +++ b/Lantern/BrowserMenuController.swift @@ -42,7 +42,7 @@ class BrowserMenuController: NSObject, NSUserInterfaceValidations { widthMenuItemsAssistant.customization.actionAndTarget = { [weak self] widthChoice in return (action: "changeWidthChoice:", target: self) } - widthMenuItemsAssistant.customization.state = { [weak self] widthChoice in + widthMenuItemsAssistant.customization.state = { widthChoice in let chosenWidthChoice = BrowserPreferences.sharedBrowserPreferences.widthChoice return (chosenWidthChoice == widthChoice) ? NSOnState : NSOffState } diff --git a/Lantern/ContentPreview.swift b/Lantern/ContentPreview.swift index 21f824c..da16090 100644 --- a/Lantern/ContentPreview.swift +++ b/Lantern/ContentPreview.swift @@ -10,7 +10,7 @@ import Cocoa // Globals are lazy in Swift -var contentPreviewStoryboard: NSStoryboard = NSStoryboard(name: "ContentPreview", bundle: nil)! +var contentPreviewStoryboard: NSStoryboard = NSStoryboard(name: "ContentPreview", bundle: nil) extension NSStoryboard { class var lantern_contentPreviewStoryboard: NSStoryboard { diff --git a/Lantern/CrawlerMenuController.swift b/Lantern/CrawlerMenuController.swift index 6ce9db9..1827cf2 100644 --- a/Lantern/CrawlerMenuController.swift +++ b/Lantern/CrawlerMenuController.swift @@ -38,7 +38,7 @@ class CrawlerMenuController: NSObject, NSUserInterfaceValidations { imageDownloadMenuItemsAssistant.customization.actionAndTarget = { [weak self] widthChoice in return (action: "changeImageDownloadChoice:", target: self) } - imageDownloadMenuItemsAssistant.customization.state = { [weak self] imageDownloadChoice in + imageDownloadMenuItemsAssistant.customization.state = { imageDownloadChoice in let chosenImageDownloadChoice = CrawlerPreferences.sharedCrawlerPreferences.imageDownloadChoice return (chosenImageDownloadChoice == imageDownloadChoice) ? NSOnState : NSOffState } diff --git a/Lantern/ImagePreviewViewController.swift b/Lantern/ImagePreviewViewController.swift index 9508840..a15bc7e 100644 --- a/Lantern/ImagePreviewViewController.swift +++ b/Lantern/ImagePreviewViewController.swift @@ -94,7 +94,7 @@ class ImagePreviewViewController: NSViewController { view.removeConstraints(self.contentSizeConstraints) } - func layoutConstraintWithView(view: NSView, #attribute: NSLayoutAttribute, #relatedBy: NSLayoutRelation, #constant: CGFloat) -> NSLayoutConstraint { + func layoutConstraintWithView(view: NSView, attribute: NSLayoutAttribute, relatedBy: NSLayoutRelation, constant: CGFloat) -> NSLayoutConstraint { let constraint = NSLayoutConstraint(item: imageView, attribute: attribute, relatedBy: relatedBy, toItem: nil, attribute: .NotAnAttribute, multiplier: 1.0, constant: constant) return constraint } @@ -145,7 +145,7 @@ class ImagePreviewViewController: NSViewController { extension ImagePreviewViewController { class func instantiateFromStoryboard() -> ImagePreviewViewController { let vc = NSStoryboard.lantern_contentPreviewStoryboard.instantiateControllerWithIdentifier("Image View Controller") as! ImagePreviewViewController - let view = vc.view // Stupid NSViewController + _ = vc.view // Stupid NSViewController return vc } } @@ -229,12 +229,12 @@ class ImagePreviewInnerViewController: NSViewController { var imageSize = imageView.imageSize() #if DEBUG - println("imageSize \(imageSize)") + print("imageSize \(imageSize)") #endif if var screenSize = view.window?.screen?.visibleFrame.size { #if DEBUG - println("screenSize \(screenSize)") + print("screenSize \(screenSize)") #endif screenSize.width -= 13.0 * 2.0 + 8.0 screenSize.height -= 13.0 * 2.0 + 32.0 @@ -248,7 +248,7 @@ class ImagePreviewInnerViewController: NSViewController { //imageSize.height -= 32.0 #if DEBUG - println("preferredContentSize \(imageSize)") + print("preferredContentSize \(imageSize)") #endif imageView.autoresizes = false @@ -269,11 +269,11 @@ class ImagePreviewInnerViewController: NSViewController { var imageData: NSData? { didSet { - let view = self.view // Stupid NSViewController + _ = self.view // Stupid NSViewController if let imageData = self.imageData { dispatch_async(backgroundQueue) { - let coreGraphicsImageSource = CGImageSourceCreateWithData(imageData, nil) + guard let coreGraphicsImageSource = CGImageSourceCreateWithData(imageData, nil) else { return } let viewedCoreGraphicsImage = CGImageSourceCreateImageAtIndex(coreGraphicsImageSource, 0, nil) let imageProperties = CGImageSourceCopyPropertiesAtIndex(coreGraphicsImageSource, 0, nil) as? [NSString: AnyObject] diff --git a/Lantern/Info.plist b/Lantern/Info.plist index 6f9b04f..6a2d9a0 100644 --- a/Lantern/Info.plist +++ b/Lantern/Info.plist @@ -17,11 +17,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.0 + 1.0.2 CFBundleSignature ???? CFBundleVersion - 14 + 15 Fabric APIKey diff --git a/Lantern/MainWindowController.swift b/Lantern/MainWindowController.swift index 36415c1..a00c6b7 100644 --- a/Lantern/MainWindowController.swift +++ b/Lantern/MainWindowController.swift @@ -30,7 +30,7 @@ class MainWindowController: NSWindowController { didSet { toolbarAssistant = MainWindowToolbarAssistant(toolbar: toolbar, mainState: mainState, modelManager: modelManager) - toolbarAssistant.prepareNewSiteButton = { [unowned self] button in + toolbarAssistant.prepareNewSiteButton = { button in button.target = nil button.action = "showAddSite:" } @@ -147,7 +147,7 @@ class MainWindowToolbarAssistant: NSObject, NSToolbarDelegate { func stopObservingModelManager() { let nc = NSNotificationCenter.defaultCenter() - for (notificationIdentifier, observer) in modelManagerNotificationObservers { + for (_, observer) in modelManagerNotificationObservers { nc.removeObserver(observer) } modelManagerNotificationObservers.removeAll(keepCapacity: false) @@ -166,7 +166,7 @@ class MainWindowToolbarAssistant: NSObject, NSToolbarDelegate { ] if let allSites = modelManager.allSites { - let allSites = allSites.sorted({ $0.name < $1.name }) + let allSites = allSites.sort({ $0.name < $1.name }) if allSites.count == 0 { result.append( @@ -199,13 +199,13 @@ class MainWindowToolbarAssistant: NSObject, NSToolbarDelegate { } - var popUpButton = sitesPopUpButton; + let popUpButton = sitesPopUpButton; popUpButton.target = self popUpButton.action = "chosenSiteDidChange:" - var popUpButtonAssistant = sitesPopUpButtonAssistant ?? { + let popUpButtonAssistant = sitesPopUpButtonAssistant ?? { let popUpButtonAssistant = PopUpButtonAssistant(popUpButton: popUpButton) let menuAssistant = popUpButtonAssistant.menuAssistant diff --git a/Lantern/MultipleStringPreviewViewController.swift b/Lantern/MultipleStringPreviewViewController.swift index 40bd0ad..a684ab3 100644 --- a/Lantern/MultipleStringPreviewViewController.swift +++ b/Lantern/MultipleStringPreviewViewController.swift @@ -43,7 +43,7 @@ class MultipleStringPreviewViewController: NSViewController { func reloadValues() { // Stupid NSViewController - let view = self.view + _ = self.view tableView.reloadData() } @@ -125,7 +125,7 @@ extension MultipleStringPreviewViewController: NSTableViewDataSource, NSTableVie setUpTableCellView(cellView, tableColumn: nil, row: row, visualsAndInteraction: false) - let tableColumn = tableView.tableColumns[0] as! NSTableColumn + let tableColumn = tableView.tableColumns[0] let cellWidth = tableColumn.width cellView.setFrameSize(NSSize(width: cellWidth, height: 100.0)) cellView.layoutSubtreeIfNeeded() @@ -157,7 +157,7 @@ extension MultipleStringPreviewViewController: NSTableViewDataSource, NSTableVie extension MultipleStringPreviewViewController: NSPopoverDelegate { func popoverWillShow(notification: NSNotification) { - let popover = notification.object as! NSPopover + //let popover = notification.object as! NSPopover //popover.appearance = NSAppearance(named: NSAppearanceNameVibrantDark) //popover.appearance = NSAppearance(named: NSAppearanceNameLightContent) //popover.appearance = .HUD diff --git a/Lantern/PageViewController.swift b/Lantern/PageViewController.swift index b329f45..4ba5356 100644 --- a/Lantern/PageViewController.swift +++ b/Lantern/PageViewController.swift @@ -9,6 +9,7 @@ import Cocoa import WebKit import LanternModel +import BurntFoundation typealias PageViewControllerGoogleOAuth2TokenCallback = (tokenJSONString: String) -> Void @@ -45,29 +46,14 @@ public class PageViewController: NSViewController { view.addConstraint(NSLayoutConstraint(item: view, attribute: .Height, relatedBy: .GreaterThanOrEqual, toItem: nil, attribute: .NotAnAttribute, multiplier: 1.0, constant: minimumHeight)) } - var webViewControllerNotificationObservers = [PageWebViewControllerNotification: AnyObject]() + var webViewControllerNotificationObserver: NotificationObserver! + //var webViewControllerNotificationObservers = [PageWebViewControllerNotification: AnyObject]() func startObservingWebViewController() { - let nc = NSNotificationCenter.defaultCenter() - let mainQueue = NSOperationQueue.mainQueue() - - func addObserver(notificationIdentifier: PageWebViewControllerNotification, block: (NSNotification!) -> Void) { - let observer = nc.addObserverForName(notificationIdentifier.notificationName, object: webViewController, queue: mainQueue, usingBlock: block) - webViewControllerNotificationObservers[notificationIdentifier] = observer - } - - addObserver(.URLDidChange) { (notification) in - self.navigatedURLDidChange(self.webViewController.URL) - } - } - - func stopObservingWebViewController() { - let nc = NSNotificationCenter.defaultCenter() - - for (notificationIdentifier, observer) in webViewControllerNotificationObservers { - nc.removeObserver(observer) + webViewControllerNotificationObserver = NotificationObserver(object: webViewController) + webViewControllerNotificationObserver.addObserver(.URLDidChange) { [weak self] notification in + self?.navigatedURLDidChange() } - webViewControllerNotificationObservers.removeAll(keepCapacity: false) } func prepareWebViewController(webViewController: PageWebViewController) { @@ -90,7 +76,9 @@ public class PageViewController: NSViewController { } } - func navigatedURLDidChange(URL: NSURL) { + func navigatedURLDidChange() { + let URL = webViewController.URL + navigatedURLDidChangeCallback?(URL: URL) updateUIForURL(URL) @@ -103,7 +91,7 @@ public class PageViewController: NSViewController { } func updateUIForURL(URL: NSURL) { - URLField.stringValue = URL.absoluteString! + URLField.stringValue = URL.absoluteString } @IBAction func URLFieldChanged(textField: NSTextField) { @@ -131,9 +119,11 @@ enum PageWebViewControllerNotification: String { } } - -let PageWebViewController_receiveWindowCloseMessageIdentifier = "windowDidClose" -let PageWebViewController_googleAPIAuthorizationChangedMessageIdentifier = "googleAPIAuthorizationChanged" +enum MessageIdentifier: String { + case receiveWindowClose = "windowDidClose" + case googleAPIAuthorizationChanged = "googleAPIAuthorizationChanged" + case console = "console" +} private var webViewURLObservingContext = 0 @@ -177,11 +167,11 @@ class PageWebViewController: NSViewController, WKNavigationDelegate, WKUIDelegat func addBundledUserScript(scriptNameInBundle: String, injectAtStart: Bool = false, injectAtEnd: Bool = false, forMainFrameOnly: Bool = true, sourceReplacements: [String:String]? = nil) { let scriptURL = NSBundle.mainBundle().URLForResource(scriptNameInBundle, withExtension: "js")! - let scriptSource = NSMutableString(contentsOfURL: scriptURL, usedEncoding: nil, error: nil)! + let scriptSource = try! NSMutableString(contentsOfURL: scriptURL, usedEncoding: nil) if let sourceReplacements = sourceReplacements { func replaceInTemplate(find target: String, replace replacement: String) { - scriptSource.replaceOccurrencesOfString(target, withString: replacement, options: NSStringCompareOptions(0), range: NSMakeRange(0, scriptSource.length)) + scriptSource.replaceOccurrencesOfString(target, withString: replacement, options: NSStringCompareOptions(rawValue: 0), range: NSMakeRange(0, scriptSource.length)) } for (placeholderID, value) in sourceReplacements { @@ -210,7 +200,7 @@ class PageWebViewController: NSViewController, WKNavigationDelegate, WKUIDelegat if allowsClosing { addBundledUserScript("windowClose", injectAtStart: true) - userContentController.addScriptMessageHandler(self, name: PageWebViewController_receiveWindowCloseMessageIdentifier) + userContentController.addScriptMessageHandler(self, name: MessageIdentifier.receiveWindowClose.rawValue) } if wantsHoverlyticsScript { @@ -228,12 +218,12 @@ class PageWebViewController: NSViewController, WKNavigationDelegate, WKUIDelegat addBundledUserScript("panelAuthorizationChanged", injectAtEnd: true, forMainFrameOnly: false) - userContentController.addScriptMessageHandler(self, name: PageWebViewController_googleAPIAuthorizationChangedMessageIdentifier) + userContentController.addScriptMessageHandler(self, name: MessageIdentifier.googleAPIAuthorizationChanged.rawValue) } webViewConfiguration.userContentController = userContentController - webView = WKWebView(frame: NSRect.zeroRect, configuration: webViewConfiguration) + webView = WKWebView(frame: NSRect.zero, configuration: webViewConfiguration) webView.navigationDelegate = self webView.UIDelegate = self webView.allowsBackForwardNavigationGestures = true @@ -291,7 +281,9 @@ class PageWebViewController: NSViewController, WKNavigationDelegate, WKUIDelegat mainQueue_notify(.URLDidChange) } - override func observeValueForKeyPath(keyPath: String, ofObject object: AnyObject, change: [NSObject : AnyObject], context: UnsafeMutablePointer) { + override func observeValueForKeyPath(keyPath: String?, ofObject object: AnyObject?, change: [String : AnyObject]?, context: UnsafeMutablePointer) { + guard let keyPath = keyPath else { return } + if context == &webViewURLObservingContext { switch keyPath { case "URL": @@ -333,7 +325,7 @@ class PageWebViewController: NSViewController, WKNavigationDelegate, WKUIDelegat func webView(webView: WKWebView, didFinishNavigation navigation: WKNavigation!) { #if DEBUG - println("didFinishNavigation \(navigation)") + print("didFinishNavigation \(navigation)") #endif } @@ -359,34 +351,35 @@ class PageWebViewController: NSViewController, WKNavigationDelegate, WKUIDelegat // MARK: WKScriptMessageHandler func userContentController(userContentController: WKUserContentController, didReceiveScriptMessage message: WKScriptMessage) { - if message.name == PageWebViewController_receiveWindowCloseMessageIdentifier { - if allowsClosing { - dismissController(nil) - } - } - else if message.name == PageWebViewController_googleAPIAuthorizationChangedMessageIdentifier { - if let body = message.body as? [String:AnyObject] { - if body["googleClientAPILoaded"] != nil { - //println("googleClientAPILoaded \(body)") + if let messageIdentifier = MessageIdentifier(rawValue: message.name) { + switch messageIdentifier { + case .receiveWindowClose: + if allowsClosing { + dismissController(nil) } - else if let tokenJSONString = body["tokenJSONString"] as? String { - hoverlyticsPanelDidReceiveGoogleOAuth2TokenCallback?(tokenJSONString: tokenJSONString) - #if DEBUG - println("tokenJSONString \(tokenJSONString)") - #endif + case .googleAPIAuthorizationChanged: + if let body = message.body as? [String:AnyObject] { + if body["googleClientAPILoaded"] != nil { + //println("googleClientAPILoaded \(body)") + } + else if let tokenJSONString = body["tokenJSONString"] as? String { + hoverlyticsPanelDidReceiveGoogleOAuth2TokenCallback?(tokenJSONString: tokenJSONString) + #if DEBUG + print("tokenJSONString \(tokenJSONString)") + #endif + } } + case .console: + #if DEBUG && false + println("CONSOLE") + if let messageBody = message.body as? [String: AnyObject] { + println("CONSOLE \(messageBody)") + } + #endif } } - else if message.name == "console" { - #if DEBUG && false - println("CONSOLE") - if let messageBody = message.body as? [String: AnyObject] { - println("CONSOLE \(messageBody)") - } - #endif - } else { - println("Unhandled script message \(message.name)") + print("Unhandled script message \(message.name)") } } diff --git a/Lantern/SiteMenuItem.swift b/Lantern/SiteMenuItem.swift index 33c3d6b..ba10c0d 100644 --- a/Lantern/SiteMenuItem.swift +++ b/Lantern/SiteMenuItem.swift @@ -57,7 +57,7 @@ extension SiteMenuItem: UIChoiceRepresentative { } } -extension SiteMenuItem: DebugPrintable { +extension SiteMenuItem: CustomDebugStringConvertible { var debugDescription: String { switch self { case .Choice(let siteChoice): diff --git a/Lantern/SiteSettings.storyboard b/Lantern/SiteSettings.storyboard index 3059a44..8087b29 100644 --- a/Lantern/SiteSettings.storyboard +++ b/Lantern/SiteSettings.storyboard @@ -1,13 +1,13 @@ - + - + - + @@ -87,7 +87,7 @@ - + diff --git a/Lantern/SiteSettingsViewController.swift b/Lantern/SiteSettingsViewController.swift index a65e979..5d7faf5 100644 --- a/Lantern/SiteSettingsViewController.swift +++ b/Lantern/SiteSettingsViewController.swift @@ -35,15 +35,15 @@ class SiteSettingsViewController: NSViewController, NSPopoverDelegate { } @IBAction func createSite(sender: NSButton) { - let (siteValues, error) = copySiteValuesFromUI() - if let siteValues = siteValues { + do { + let siteValues = try copySiteValuesFromUI() modelManager.createSiteWithValues(siteValues) mainState.siteChoice = .SavedSite(siteValues) self.dismissController(nil) prepareForReuse() } - else if let error = error { - NSApplication.sharedApplication().presentError(error, modalForWindow: self.view.window!, delegate: nil, didPresentSelector: nil, contextInfo: nil) + catch { + NSApplication.sharedApplication().presentError(error as NSError, modalForWindow: self.view.window!, delegate: nil, didPresentSelector: nil, contextInfo: nil) } } @@ -55,39 +55,20 @@ class SiteSettingsViewController: NSViewController, NSPopoverDelegate { func updateUIWithSiteValues(siteValues: SiteValues) { // Make sure view has loaded - let view = self.view + _ = self.view nameField.stringValue = siteValues.name - homePageURLField.stringValue = siteValues.homePageURL.absoluteString! + homePageURLField.stringValue = siteValues.homePageURL.absoluteString } - func copySiteValuesFromUI(UUID: NSUUID? = nil) -> (SiteValues?, NSError?) { + func copySiteValuesFromUI(UUID UUID: NSUUID? = nil) throws -> SiteValues { // Make sure view has loaded - let view = self.view + _ = self.view - let errorDomain = "SiteSettingsViewController.validationErrorDomain" + let name = try ValidationError.validateString(nameField.stringValue, identifier: "Name") + let homePageURL = try ValidationError.validateURLString(homePageURLField.stringValue, identifier: "Home Page URL") - let name = nameField.stringValue - let validatedName = ValidationError.validateString(name, identifier: "Name") - if let error = validatedName.error { - return (nil, error) - } - /*if let error = ValueValidation.InputtedString(name).validateReturningCocoaError { - return (nil, error) - }*/ - - let homePageURLString = homePageURLField.stringValue - /*if let error = ValueValidation.InputtedURLString(name).validateReturningCocoaError { - return (nil, error) - }*/ - let validatedHomePageURL = ValidationError.validateURLString(homePageURLString, identifier: "Home Page URL") - if let error = validatedHomePageURL.error { - return (nil, error) - } - let homePageURL = validatedHomePageURL.URL! - - let siteValues = SiteValues(name: name, homePageURL: homePageURL, UUID: UUID ?? NSUUID()) - return (siteValues, nil) + return SiteValues(name: name, homePageURL: homePageURL, UUID: UUID ?? NSUUID()) } // MARK NSPopoverDelegate diff --git a/Lantern/SourcePreviewViewController.swift b/Lantern/SourcePreviewViewController.swift index fa5689c..c15db50 100644 --- a/Lantern/SourcePreviewViewController.swift +++ b/Lantern/SourcePreviewViewController.swift @@ -61,7 +61,7 @@ class SourcePreviewTabViewController: NSTabViewController { // This crashes for some reason // self.tabViewItems = tabViewItems - let existingItems = self.tabViewItems as! [NSTabViewItem] + let existingItems = self.tabViewItems for existingItem in existingItems { removeTabViewItem(existingItem) } @@ -80,7 +80,7 @@ class SourcePreviewTabViewController: NSTabViewController { updateWithSections([.HTMLHead, .HTMLBody]) } - func newSourcePreviewTabViewItem(#section: SourcePreviewTabItemSection) -> NSTabViewItem { + func newSourcePreviewTabViewItem(section section: SourcePreviewTabItemSection) -> NSTabViewItem { let item = NSTabViewItem(identifier: section.stringValue) let vc = newSourcePreviewController() @@ -119,10 +119,11 @@ class SourcePreviewTabViewController: NSTabViewController { vc.sourceText = sourceText ?? "(None)" } - override func tabView(tabView: NSTabView, willSelectTabViewItem tabViewItem: NSTabViewItem) { - if - let identifier = tabViewItem.identifier as? String, - let section = SourcePreviewTabItemSection(rawValue: identifier) + override func tabView(tabView: NSTabView, willSelectTabViewItem tabViewItem: NSTabViewItem?) { + if let + tabViewItem = tabViewItem, + identifier = tabViewItem.identifier as? String, + section = SourcePreviewTabItemSection(rawValue: identifier) { updateSourceTextForSection(section, tabViewItem: tabViewItem) } @@ -146,7 +147,7 @@ extension SourcePreviewTabViewController: NSPopoverDelegate { func popoverDidShow(notification: NSNotification) { if let window = view.window where selectedTabViewItemIndex != -1 { - let tabViewItem = tabViewItems[selectedTabViewItemIndex] as! NSTabViewItem + let tabViewItem = tabViewItems[selectedTabViewItemIndex] let vc = tabViewItem.viewController as! SourcePreviewViewController window.makeFirstResponder(vc.textView) } @@ -169,14 +170,14 @@ class SourcePreviewViewController: NSViewController { textView.wantsToDismiss = wantsToDismiss } - let defaultTextAttributes: [NSObject: AnyObject] = [ + let defaultTextAttributes: [String: AnyObject] = [ NSFontAttributeName: NSFont(name: "Menlo", size: 11.0)!, NSForegroundColorAttributeName: NSColor.highlightColor() ] var sourceText: String! { didSet { - let view = self.view // Make sure view has loaded + _ = self.view // Make sure view has loaded if let textStorage = textView.textStorage { let attributes = defaultTextAttributes diff --git a/Lantern/StatsViewController.swift b/Lantern/StatsViewController.swift index f4a0edb..4b1c58c 100644 --- a/Lantern/StatsViewController.swift +++ b/Lantern/StatsViewController.swift @@ -197,7 +197,7 @@ extension StatsColumnsMode: UIChoiceRepresentative { var uniqueIdentifier: UniqueIdentifier { return self } } -extension StatsColumnsMode: Printable { +extension StatsColumnsMode: CustomStringConvertible { var description: String { return title } @@ -379,7 +379,7 @@ class StatsViewController: NSViewController { var selectedURLs: [NSURL] { get { let outlineView = self.outlineView! - var selectedRowIndexes = outlineView.selectedRowIndexes + let selectedRowIndexes = outlineView.selectedRowIndexes var result = [NSURL]() selectedRowIndexes.enumerateIndexesUsingBlock { (row, stopPointer) in if let item = outlineView.itemAtRow(row) as? NSURL { @@ -390,7 +390,7 @@ class StatsViewController: NSViewController { } set { let outlineView = self.outlineView! - var newRowIndexes = NSMutableIndexSet() + let newRowIndexes = NSMutableIndexSet() for URL in newValue { let row = outlineView.rowForItem(URL) if row != -1 { @@ -423,7 +423,7 @@ class StatsViewController: NSViewController { let pageLinkFilter = filterResponseChoice.pageLinkFilterWithURL(browsedURL) { #if DEBUG - println("filtering to browsedURL \(browsedURL)") + print("filtering to browsedURL \(browsedURL)") #endif filteredURLs = pageMapper.copyHTMLPageURLsFilteredBy(pageLinkFilter) } @@ -505,7 +505,7 @@ class StatsViewController: NSViewController { private func updateColumnsToOnlyShow(columnIdentifiers: [PagePresentedInfoIdentifier]) { func updateHeaderOfColumn(column: NSTableColumn, withTitleFromIdentifier identifier: PagePresentedInfoIdentifier) { - (column.headerCell as! NSTableHeaderCell).stringValue = identifier.titleForBaseContentType(filterToBaseContentType) + column.headerCell.stringValue = identifier.titleForBaseContentType(filterToBaseContentType) } let minColumnWidth: CGFloat = 130.0 @@ -568,7 +568,7 @@ class StatsViewController: NSViewController { if let contentChoice = baseContentTypeChoicePopUpButtonAssistant.selectedItemRepresentative { chosenBaseContentChoice = contentChoice - updateUI(baseContentType: false) + updateUI(false) } } @@ -856,7 +856,7 @@ extension StatsViewController { sourcePreviewTabViewController.pageInfo = pageInfo let rowRect = outlineView.rectOfRow(row) - presentViewController(sourcePreviewTabViewController, asPopoverRelativeToRect: rowRect, ofView: outlineView, preferredEdge: NSMinYEdge, behavior: .Semitransient) + presentViewController(sourcePreviewTabViewController, asPopoverRelativeToRect: rowRect, ofView: outlineView, preferredEdge: NSRectEdge.MinY, behavior: .Semitransient) } } } @@ -866,7 +866,7 @@ extension StatsViewController { } func showStringValuePreviewForResourceAtRow(row: Int, column: Int) { - let tableColumn = outlineView.tableColumns[column] as! NSTableColumn + let tableColumn = outlineView.tableColumns[column] if let presentedInfoIdentifier = presentedInfoIdentifierForTableColumn(tableColumn), @@ -887,7 +887,7 @@ extension StatsViewController { } let rowRect = outlineView.frameOfCellAtColumn(column, row: row) - presentViewController(previewViewController, asPopoverRelativeToRect: rowRect, ofView: outlineView, preferredEdge: NSMinYEdge, behavior: .Semitransient) + presentViewController(previewViewController, asPopoverRelativeToRect: rowRect, ofView: outlineView, preferredEdge: NSRectEdge.MinY, behavior: .Semitransient) } } } @@ -907,7 +907,7 @@ extension StatsViewController { previewViewController.sourceURL = pageInfo.requestedURL let rowRect = outlineView.rectOfRow(row) - presentViewController(previewViewController, asPopoverRelativeToRect: rowRect, ofView: outlineView, preferredEdge: NSMinYEdge, behavior: .Semitransient) + presentViewController(previewViewController, asPopoverRelativeToRect: rowRect, ofView: outlineView, preferredEdge: NSRectEdge.MinY, behavior: .Semitransient) } } @@ -923,7 +923,7 @@ extension StatsViewController { //println("Copying \(success) \(pasteboard) \(URL)") pasteboard.declareTypes([NSURLPboardType, NSStringPboardType], owner: nil) URL.writeToPasteboard(pasteboard) - pasteboard.setString(URL.absoluteString!, forType: NSStringPboardType) + pasteboard.setString(URL.absoluteString, forType: NSStringPboardType) } } } @@ -975,7 +975,7 @@ extension StatsViewController { popUpButton.animator().hidden = false } - var popUpButtonAssistant = filterResponseChoicePopUpButtonAssistant ?? { + let popUpButtonAssistant = filterResponseChoicePopUpButtonAssistant ?? { let popUpButtonAssistant = PopUpButtonAssistant(popUpButton: popUpButton) let menuAssistant = popUpButtonAssistant.menuAssistant @@ -1124,7 +1124,7 @@ extension StatsViewController: NSOutlineViewDataSource, NSOutlineViewDelegate { let identifierString = tableColumn?.identifier, let identifier = PagePresentedInfoIdentifier(rawValue: identifierString) { - var cellIdentifier = (identifier == .requestedURL ? "requestedURL" : "text") + let cellIdentifier = (identifier == .requestedURL ? "requestedURL" : "text") var menu: NSMenu? var stringValue: String @@ -1175,6 +1175,10 @@ extension StatsViewController: NSOutlineViewDataSource, NSOutlineViewDelegate { if let view = outlineView.makeViewWithIdentifier(cellIdentifier, owner: self) as? NSTableCellView { if let textField = view.textField { + if let suffixString = suffixString { + stringValue += " \(suffixString)" + } + textField.stringValue = stringValue textField.textColor = textColor } diff --git a/Lantern/TableView-OutlineView-Subclass.swift b/Lantern/TableView-OutlineView-Subclass.swift index 31c743b..eb05f00 100644 --- a/Lantern/TableView-OutlineView-Subclass.swift +++ b/Lantern/TableView-OutlineView-Subclass.swift @@ -16,7 +16,7 @@ extension NSTableView { let point = convertPoint(event.locationInWindow, fromView: nil) let row = rowAtPoint(point) if row != -1 { - if let rowView = rowViewAtRow(row, makeIfNecessary: true) as? NSTableRowView { + if let rowView = rowViewAtRow(row, makeIfNecessary: true) { let column = columnAtPoint(point) if column != -1 { if let cellView = rowView.viewAtColumn(column) as? NSTableCellView { diff --git a/Lantern/ViewController.swift b/Lantern/ViewController.swift index 9684523..6fae36c 100644 --- a/Lantern/ViewController.swift +++ b/Lantern/ViewController.swift @@ -49,7 +49,7 @@ class ViewController: NSViewController func stopObservingModelManager() { let nc = NSNotificationCenter.defaultCenter() - for (notificationIdentifier, observer) in mainStateNotificationObservers { + for (_, observer) in mainStateNotificationObservers { nc.removeObserver(observer) } mainStateNotificationObservers.removeAll(keepCapacity: false) @@ -79,7 +79,7 @@ class ViewController: NSViewController lazy var pageStoryboard: NSStoryboard = { - NSStoryboard(name: "Page", bundle: nil)! + NSStoryboard(name: "Page", bundle: nil) }() var mainSplitViewController: NSSplitViewController! var pageViewController: PageViewController! @@ -146,7 +146,7 @@ class ViewController: NSViewController }() #if DEBUG - println("navigatedURLDidChangeCallback \(URL)") + print("navigatedURLDidChangeCallback \(URL)") #endif self.statsViewController.didNavigateToURL(URL, crawl: isLocal) } @@ -177,7 +177,8 @@ class ViewController: NSViewController } - lazy var siteSettingsStoryboard = NSStoryboard(name: "SiteSettings", bundle: nil)! + //lazy var siteSettingsStoryboard = NSStoryboard(name: "SiteSettings", bundle: nil) + var siteSettingsStoryboard = NSStoryboard(name: "SiteSettings", bundle: nil) lazy var addSiteViewController: SiteSettingsViewController = { let vc = self.siteSettingsStoryboard.instantiateControllerWithIdentifier("Add Site View Controller") as! SiteSettingsViewController vc.modelManager = self.modelManager @@ -197,7 +198,7 @@ class ViewController: NSViewController dismissViewController(addSiteViewController) } else { - presentViewController(addSiteViewController, asPopoverRelativeToRect: relativeView.bounds, ofView: relativeView, preferredEdge: NSMaxYEdge, behavior: .Semitransient) + presentViewController(addSiteViewController, asPopoverRelativeToRect: relativeView.bounds, ofView: relativeView, preferredEdge: NSRectEdge.MaxY, behavior: .Semitransient) } } @@ -214,13 +215,16 @@ class ViewController: NSViewController let modelManager = self.modelManager siteSettingsViewController.willClose = { siteSettingsViewController in let UUID = chosenSite.UUID - let (siteValues, error) = siteSettingsViewController.copySiteValuesFromUI(UUID: UUID) - if let siteValues = siteValues { + do { + let siteValues = try siteSettingsViewController.copySiteValuesFromUI(UUID: UUID) modelManager.updateSiteWithUUID(UUID, withValues: siteValues) } + catch { + NSApplication.sharedApplication().presentError(error as NSError, modalForWindow: self.view.window!, delegate: nil, didPresentSelector: nil, contextInfo: nil) + } } - presentViewController(siteSettingsViewController, asPopoverRelativeToRect: button.bounds, ofView: button, preferredEdge: NSMaxYEdge, behavior: .Semitransient) + presentViewController(siteSettingsViewController, asPopoverRelativeToRect: button.bounds, ofView: button, preferredEdge: NSRectEdge.MaxY, behavior: .Semitransient) } } } diff --git a/Lantern/WKUserContentController+bundledScripts.swift b/Lantern/WKUserContentController+bundledScripts.swift index 0f70230..56baa3e 100644 --- a/Lantern/WKUserContentController+bundledScripts.swift +++ b/Lantern/WKUserContentController+bundledScripts.swift @@ -15,11 +15,11 @@ extension WKUserContentController { assert(injectAtStart || injectAtEnd, "User script must either be injected at start or at end. Add injectAtStart: true or injectAtEnd: true") let scriptURL = NSBundle.mainBundle().URLForResource(scriptNameInBundle, withExtension: "js")! - let scriptSource = NSMutableString(contentsOfURL: scriptURL, usedEncoding: nil, error: nil)! + let scriptSource = try! NSMutableString(contentsOfURL: scriptURL, usedEncoding: nil) if let sourceReplacements = sourceReplacements { func replaceInTemplate(find target: String, replace replacement: String) { - scriptSource.replaceOccurrencesOfString(target, withString: replacement, options: NSStringCompareOptions(0), range: NSMakeRange(0, scriptSource.length)) + scriptSource.replaceOccurrencesOfString(target, withString: replacement, options: NSStringCompareOptions(rawValue: 0), range: NSMakeRange(0, scriptSource.length)) } for (placeholderID, value) in sourceReplacements { diff --git a/LanternModel/Info.plist b/LanternModel/Info.plist index ca2deba..c053f82 100644 --- a/LanternModel/Info.plist +++ b/LanternModel/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 1.0 + 1.0.1 CFBundleSignature ???? CFBundleVersion diff --git a/LanternModel/ModelManager.swift b/LanternModel/ModelManager.swift index 8394351..c7f7dc2 100644 --- a/LanternModel/ModelManager.swift +++ b/LanternModel/ModelManager.swift @@ -68,12 +68,16 @@ public class ModelManager { let store = ListJSONFileStore(creatingList: { items in return ArrayList(items: items) }, loadedFromURL: JSONURL, options: storeOptions) - store.ensureLoaded{ (list, error) in - if let list = list { + store.ensureLoaded { getList in + do { + let list = try getList() list.addObserver(self.sitesListObserver) self.sitesList = list self.notifyAllSitesDidChange() } + catch { + + } } self.sitesListStore = store @@ -85,10 +89,6 @@ public class ModelManager { } - deinit { - let nc = NSNotificationCenter.defaultCenter() - } - public class var sharedManager: ModelManager { struct Helper { static let sharedManager = ModelManager() diff --git a/LanternModel/NSData+ONOXMLDocument.swift b/LanternModel/NSData+ONOXMLDocument.swift index 0221dfa..d7cde1c 100644 --- a/LanternModel/NSData+ONOXMLDocument.swift +++ b/LanternModel/NSData+ONOXMLDocument.swift @@ -12,7 +12,7 @@ import Ono extension NSData { func stringRepresentationUsingONOXMLDocumentHints(document: ONOXMLDocument) -> String? { - var stringEncoding = document.stringEncodingWithFallback() + let stringEncoding = document.stringEncodingWithFallback() return NSString(data: self, encoding: stringEncoding) as? String } } \ No newline at end of file diff --git a/LanternModel/PageInfo.swift b/LanternModel/PageInfo.swift index e193f52..2d27816 100644 --- a/LanternModel/PageInfo.swift +++ b/LanternModel/PageInfo.swift @@ -21,7 +21,7 @@ public enum BaseContentType { case Essential } -extension BaseContentType: DebugPrintable { +extension BaseContentType: CustomDebugStringConvertible { public var debugDescription: String { switch self { case .Unknown: @@ -87,7 +87,7 @@ extension PageResponseType { -internal func URLIsExternal(URLToTest: NSURL, #localHost: String) -> Bool { +internal func URLIsExternal(URLToTest: NSURL, localHost: String) -> Bool { if let host = URLToTest.host { if host.caseInsensitiveCompare(localHost) != .OrderedSame { return true @@ -100,8 +100,7 @@ internal func URLIsExternal(URLToTest: NSURL, #localHost: String) -> Bool { private let fileDownloadFileExtensions = Set(["zip", "dmg", "exe", "pdf", "gz", "tar", "doc", "docx", "xls", "wav", "aiff", "mp3", "mp4", "mov", "avi", "wmv"]) func linkedURLLooksLikeFileDownload(URL: NSURL) -> Bool { - if let path = URL.path { - let pathExtension = path.pathExtension + if let pathExtension = URL.pathExtension { if fileDownloadFileExtensions.contains(pathExtension) { return true } @@ -164,7 +163,7 @@ extension MIMETypeString { } } -extension MIMETypeString: Printable { +extension MIMETypeString: CustomStringConvertible { public var description: String { return stringValue } @@ -226,14 +225,15 @@ public struct PageContentInfo { self.data = data var error: NSError? - if let document = ONOXMLDocument.HTMLDocumentWithData(data, error: &error) { + do { + let document = try ONOXMLDocument.HTMLDocumentWithData(data) self.stringEncoding = document.stringEncodingWithFallback() // Must store document to also save references to all found elements. self.document = document let stringEncoding = document.stringEncodingWithFallback() if let bodyTagData = "() @@ -343,8 +343,8 @@ public struct PageContentInfo { h1Elements = document.allElementsWithCSS("h1") richSnippetElements = [] //TODO: - } - else { + } catch let error1 as NSError { + error = error1 document = nil stringEncoding = nil diff --git a/LanternModel/PageInfoRequest.swift b/LanternModel/PageInfoRequest.swift index 13b070a..7dbeaef 100644 --- a/LanternModel/PageInfoRequest.swift +++ b/LanternModel/PageInfoRequest.swift @@ -57,11 +57,14 @@ class PageInfoRequestQueue { let managerDelegate = manager.delegate managerDelegate.taskWillPerformHTTPRedirection = { [weak self] session, task, response, request in #if DEBUG - println("taskWillPerformHTTPRedirection") + print("taskWillPerformHTTPRedirection") #endif - if let willPerformHTTPRedirection = self?.willPerformHTTPRedirection { - let info = RequestRedirectionInfo(sourceRequest: task.originalRequest, nextRequest: request, statusCode: response.statusCode, MIMEType: MIMETypeString(response.MIMEType)) + if let + willPerformHTTPRedirection = self?.willPerformHTTPRedirection, + originalRequest = task.originalRequest + { + let info = RequestRedirectionInfo(sourceRequest: originalRequest, nextRequest: request, statusCode: response.statusCode, MIMEType: MIMETypeString(response.MIMEType)) willPerformHTTPRedirection(redirectionInfo: info) } @@ -70,7 +73,8 @@ class PageInfoRequestQueue { } func addRequestForURL(URL: NSURL, expectedBaseContentType: BaseContentType, includingContent: Bool, highPriority: Bool = false, completionHandler: PageInfoRequest.CompletionHandler) -> PageInfoRequest? { - if let URL = URL.absoluteURL where URL.host != nil { + let URL = URL.absoluteURL + if URL.host != nil { let infoRequest = PageInfoRequest(URL: URL, expectedBaseContentType: expectedBaseContentType, includingContent: includingContent, completionHandler: completionHandler) if highPriority || activeRequests.count < maximumActiveRequests { @@ -104,7 +108,7 @@ class PageInfoRequestQueue { return infoRequest.URL.absoluteString == URLAbsoluteString } - for (index, request) in enumerate(pendingRequests) { + for (index, request) in pendingRequests.enumerate() { if requestContainsURL(request) { pendingRequests.removeAtIndex(index) break @@ -124,7 +128,7 @@ class PageInfoRequestQueue { infoRequest.completionHandler(info: info, infoRequest: infoRequest) // Remove from active requests - for (index, someRequest) in enumerate(activeRequests) { + for (index, someRequest) in activeRequests.enumerate() { if someRequest === infoRequest { activeRequests.removeAtIndex(index) break @@ -158,10 +162,12 @@ class PageInfoRequestQueue { let info = PageInfo(requestedURL: requestedURL, finalURL: response.URL, statusCode: response.statusCode, baseContentType: baseContentType, MIMEType: MIMEType, byteCount: byteCount, contentInfo: contentInfo) - return (info, nil) + return .Success(info) } else { - return (nil, nil) + let failureReason = "Data could not be serialized. Input data was nil." + let error = Alamofire.Error.errorWithCode(Alamofire.Error.Code.DataSerializationFailed, failureReason: failureReason) + return .Failure(data, error) } } @@ -169,14 +175,11 @@ class PageInfoRequestQueue { let requestedURL = infoRequest.URL infoRequest.request = requestManager .request(infoRequest.method, requestedURL) - .response(responseSerializer: serializer) { (URLRequest, response, info, error) in - if let - response = response, - info = info - { + .response(responseSerializer: serializer, completionHandler: { (URLRequest, response, result) in + if case let .Success(info) = result { self.activeRequestDidComplete(infoRequest, withInfo: info) } - } + }) } func cancelAll(clearAll: Bool = true) { @@ -191,7 +194,7 @@ class PageInfoRequestQueue { } else { // Put imcomplete requests back on the queue - pendingRequests.splice(activeRequests, atIndex: 0) + pendingRequests.insertContentsOf(activeRequests, at: 0) } activeRequests.removeAll() diff --git a/LanternModel/PageMapper+Filtering.swift b/LanternModel/PageMapper+Filtering.swift index f34ff9d..6a2c35f 100644 --- a/LanternModel/PageMapper+Filtering.swift +++ b/LanternModel/PageMapper+Filtering.swift @@ -29,7 +29,7 @@ public extension PageMapper { } // Else any response type: tally them up. else if let responseTypeToURLCount = baseContentTypeToResponseTypeToURLCount[baseContentType] { - return reduce(responseTypeToURLCount, UInt(0), { (totalSoFar, dictIndex) -> UInt in + return responseTypeToURLCount.reduce(UInt(0), combine: { (totalSoFar, dictIndex) -> UInt in let (responseType, URLCount) = dictIndex return totalSoFar + URLCount }) @@ -53,7 +53,7 @@ public extension PageMapper { } public func copyURLsWithBaseContentType(type: BaseContentType, withResponseType responseType: PageResponseType) -> [NSURL] { - var URLs: [NSURL] = copyURLsWithBaseContentType(type) + let URLs: [NSURL] = copyURLsWithBaseContentType(type) return URLs.filter { (URL) in if diff --git a/LanternModel/PageMapper+InfoPresenting.swift b/LanternModel/PageMapper+InfoPresenting.swift index d535dc5..063fbeb 100644 --- a/LanternModel/PageMapper+InfoPresenting.swift +++ b/LanternModel/PageMapper+InfoPresenting.swift @@ -164,13 +164,10 @@ public enum PagePresentedInfoIdentifier: String { return ValidatedStringValue(string: "\(requestedPath) (\(finalURLPath))") } - if - let requestedScheme = requestedURL.scheme, - let finalScheme = finalURL.scheme - { - if requestedScheme != finalScheme { - return ValidatedStringValue(string: "\(requestedPath) (\(finalURLPath) to \(finalScheme))") - } + let requestedScheme = requestedURL.scheme + let finalScheme = finalURL.scheme + if requestedScheme != finalScheme { + return ValidatedStringValue(string: "\(requestedPath) (\(finalURLPath) to \(finalScheme))") } return ValidatedStringValue(string: "\(requestedPath) (\(finalURLPath))") diff --git a/LanternModel/PageMapper+LinkFiltering.swift b/LanternModel/PageMapper+LinkFiltering.swift index 767644b..b4af946 100644 --- a/LanternModel/PageMapper+LinkFiltering.swift +++ b/LanternModel/PageMapper+LinkFiltering.swift @@ -18,7 +18,7 @@ public enum PageLinkFilter { extension PageMapper { public func copyHTMLPageURLsFilteredBy(linkFilter: PageLinkFilter) -> [NSURL] { - var URLs = copyURLsWithBaseContentType(.LocalHTMLPage, withResponseType: .Successful) + let URLs = copyURLsWithBaseContentType(.LocalHTMLPage, withResponseType: .Successful) switch linkFilter { case .IsLinkedByURL(let linkedByURL): diff --git a/LanternModel/PageMapper+Validating.swift b/LanternModel/PageMapper+Validating.swift index 9b19e25..447b42b 100644 --- a/LanternModel/PageMapper+Validating.swift +++ b/LanternModel/PageMapper+Validating.swift @@ -24,7 +24,7 @@ private let nonWhitespaceCharacterSet = whitespaceCharacterSet.invertedSet private func stringIsJustWhitespace(string: String) -> Bool { // Return range if non-whitespace characters are present, nil if no non-whitespace characters are present. - return string.rangeOfCharacterFromSet(nonWhitespaceCharacterSet, options: .allZeros, range: nil) == nil + return string.rangeOfCharacterFromSet(nonWhitespaceCharacterSet, options: [], range: nil) == nil } extension PageInfoValidationResult { @@ -124,38 +124,33 @@ extension PageInfo { public extension PageMapper { public func copyHTMLPageURLsWhichCompletelyValidateForType(type: BaseContentType) -> [NSURL] { let validationAreas = PageInfoValidationArea.allAreas - var URLs = copyURLsWithBaseContentType(type, withResponseType: .Successful) + let URLs = copyURLsWithBaseContentType(type, withResponseType: .Successful) - return URLs.filter { (URL) in - if let pageInfo = self.loadedURLToPageInfo[URL] { - for validationArea in validationAreas { - let validationResult = pageInfo.validateArea(validationArea) - return validationResult == .Valid - } + return URLs.filter { URL in + guard let pageInfo = self.loadedURLToPageInfo[URL] else { return false } + + let containsInvalidResult = validationAreas.contains { validationArea in + return pageInfo.validateArea(validationArea) != .Valid } - return false + return !containsInvalidResult } } public func copyHTMLPageURLsForType(type: BaseContentType, failingToValidateInArea validationArea: PageInfoValidationArea) -> [NSURL] { - var URLs = copyURLsWithBaseContentType(type, withResponseType: .Successful) + let URLs = copyURLsWithBaseContentType(type, withResponseType: .Successful) - return URLs.filter { (URL) in - if let pageInfo = self.loadedURLToPageInfo[URL] { - let validationResult = pageInfo.validateArea(validationArea) - var isValid: Bool - switch validationResult { - case .Valid: - return false - case .Missing: - return validationArea.isRequired // Only invalid if it is required - default: - return true - } - } + return URLs.filter { URL in + guard let pageInfo = self.loadedURLToPageInfo[URL] else { return false } - return false + switch pageInfo.validateArea(validationArea) { + case .Valid: + return false + case .Missing: + return validationArea.isRequired // Only invalid if it is required + default: + return true + } } } } diff --git a/LanternModel/PageMapper.swift b/LanternModel/PageMapper.swift index 71e0bc7..c0411c5 100644 --- a/LanternModel/PageMapper.swift +++ b/LanternModel/PageMapper.swift @@ -115,7 +115,7 @@ public class PageMapper { let nextURL = redirectionInfo.nextRequest.URL { #if DEBUG - println("REDIRECT \(sourceURL) \(nextURL)") + print("REDIRECT \(sourceURL) \(nextURL)") #endif pageMapper.redirectedSourceURLToInfo[sourceURL] = redirectionInfo @@ -216,7 +216,7 @@ public class PageMapper { if responseType == .Redirects { #if DEBUG - println("REDIRECT \(requestedPageURL) \(pageInfo.finalURL)") + print("REDIRECT \(requestedPageURL) \(pageInfo.finalURL)") #endif } @@ -258,7 +258,7 @@ public class PageMapper { } if let - childDepth = map(currentDepth, { $0 + 1 }), + childDepth = currentDepth.map({ $0 + 1 }), contentInfo = pageInfo.contentInfo where childDepth <= maximumDepth { @@ -344,7 +344,7 @@ public class PageMapper { didUpdateCallback = nil - infoRequestQueue.cancelAll(clearAll: true) + infoRequestQueue.cancelAll(true) } public func summedByteCountForBaseContentType(type: BaseContentType) -> UInt { diff --git a/LanternModel/Site.swift b/LanternModel/Site.swift index 413e4a1..0009a53 100644 --- a/LanternModel/Site.swift +++ b/LanternModel/Site.swift @@ -70,7 +70,7 @@ extension SiteValues { private func updateStoredValues(var values: ValueStorable) -> ValueStorable { values["name"] = name - values["homePageURL"] = homePageURL.absoluteString! + values["homePageURL"] = homePageURL.absoluteString values["UUID"] = UUID.UUIDString return values diff --git a/LanternModel/SiteEssentialsInfo.swift b/LanternModel/SiteEssentialsInfo.swift index 954d282..d979869 100644 --- a/LanternModel/SiteEssentialsInfo.swift +++ b/LanternModel/SiteEssentialsInfo.swift @@ -66,7 +66,7 @@ public class SiteEssentialInfoRequest { resourceRequests = [String: PageInfoRequest]() resourceInfos = [String: PageInfo]() - func addResourceRequest(#pathComponent: String, identifier: String? = nil) { + func addResourceRequest(pathComponent pathComponent: String, identifier: String? = nil) { let identifier = identifier ?? pathComponent func requestCompletionHandler(info: PageInfo) { diff --git a/LanternModel/UniqueURLArray.swift b/LanternModel/UniqueURLArray.swift index a0b1bc1..2e5ca44 100644 --- a/LanternModel/UniqueURLArray.swift +++ b/LanternModel/UniqueURLArray.swift @@ -55,7 +55,7 @@ class UniqueURLArray: SequenceType { return false } - func insertReturningConformedURLIfNew(var URL: NSURL) -> NSURL? { + func insertReturningConformedURLIfNew(URL: NSURL) -> NSURL? { if let URL = conformURL(URL) { if !uniqueURLs.contains(URL) { uniqueURLs.insert(URL) @@ -72,7 +72,7 @@ class UniqueURLArray: SequenceType { if let setIndex = uniqueURLs.indexOf(URL) { uniqueURLs.removeAtIndex(setIndex) - if let arrayIndex = find(orderedURLs, URL) { + if let arrayIndex = orderedURLs.indexOf(URL) { orderedURLs.removeAtIndex(arrayIndex) } } @@ -85,7 +85,7 @@ class UniqueURLArray: SequenceType { } } -extension UniqueURLArray: Printable { +extension UniqueURLArray: CustomStringConvertible { var description: String { return uniqueURLs.description } diff --git a/LanternModel/ValidatedStringValue.swift b/LanternModel/ValidatedStringValue.swift index 5ff445f..53cef68 100644 --- a/LanternModel/ValidatedStringValue.swift +++ b/LanternModel/ValidatedStringValue.swift @@ -48,7 +48,7 @@ extension ValidatedStringValue { } static func validateContentOfElement(element: ONOXMLElement) -> ValidatedStringValue { - var stringValue = element.stringValue() + let stringValue = element.stringValue() return self.init(string: stringValue, trimmingSpace: true, combineSpaces: true) } @@ -61,10 +61,9 @@ extension ValidatedStringValue { case 0: return .Missing default: - var values: [ValidatedStringValue] = elements.map { element in + return .Multiple(elements.map { element in return self.validateContentOfElement(element) - } - return .Multiple(values) + }) } } @@ -85,7 +84,7 @@ extension ValidatedStringValue { case 0: return .Missing default: - var values: [ValidatedStringValue] = elements.map { element in + let values: [ValidatedStringValue] = elements.map { element in return self.validateAttribute(attribute, ofElement: element) } return .Multiple(values) diff --git a/LanternModel/ValueValidation.swift b/LanternModel/ValueValidation.swift index 2423599..00f14a7 100644 --- a/LanternModel/ValueValidation.swift +++ b/LanternModel/ValueValidation.swift @@ -9,36 +9,36 @@ import Foundation -public let ValueValidationErrorDomain = "LanternModel.ValueValidation.errorDomain" - -public enum ValueValidationErrorCode: Int { - case StringIsEmpty = 10 - - case URLStringIsInvalid = 20 -} - - private let whitespaceCharacterSet = NSCharacterSet.whitespaceAndNewlineCharacterSet() -public enum ValidationError { +public enum ValidationError: ErrorType { case StringIsEmpty(string: String, identifier: String) case URLStringIsInvalid(string: String, identifier: String) + static let errorDomain = "LanternModel.ValueValidation.errorDomain" + + private enum ErrorCode: Int { + case StringIsEmpty = 10 + + case URLStringIsInvalid = 20 + } + + var errorCode: Int { switch self { case StringIsEmpty: - return ValueValidationErrorCode.StringIsEmpty.rawValue + return ErrorCode.StringIsEmpty.rawValue case URLStringIsInvalid: - return ValueValidationErrorCode.URLStringIsInvalid.rawValue + return ErrorCode.URLStringIsInvalid.rawValue } } var description: String { switch self { - case StringIsEmpty(let string, let identifier): + case StringIsEmpty(_, let identifier): return "Please enter something for \"\(identifier)\"" - case URLStringIsInvalid(let string, let identifier): + case URLStringIsInvalid(_, let identifier): return "Please enter a valid URL for \"\(identifier)\"" } } @@ -47,34 +47,37 @@ public enum ValidationError { let userInfo = [ NSLocalizedDescriptionKey: self.description ] - return NSError(domain: ValueValidationErrorDomain, code: self.errorCode, userInfo: userInfo) + return NSError(domain: ValidationError.errorDomain, code: self.errorCode, userInfo: userInfo) } - public static func validateString(string: String, identifier: String) -> (string: String?, error: NSError?) { + public static func validateString(string: String, identifier: String) throws -> String { let string = string.stringByTrimmingCharactersInSet(whitespaceCharacterSet) if string.isEmpty { - return (nil, self.StringIsEmpty(string: string, identifier: identifier).cocoaError) + throw self.StringIsEmpty(string: string, identifier: identifier).cocoaError } - return (string, nil) + return string } - public static func validateURLString(URLString: String, identifier: String) -> (URL: NSURL?, error: NSError?) { - if let URL = detectWebURL(fromString: URLString) { - return (URL, nil) + public static func validateURLString(URLString: String, identifier: String) throws -> NSURL { + do { + guard let URL = detectWebURL(fromString: URLString) else { + throw self.URLStringIsInvalid(string: URLString, identifier: identifier).cocoaError + } + + return URL } - else { - return (nil, self.URLStringIsInvalid(string: URLString, identifier: identifier).cocoaError) + catch { + throw self.URLStringIsInvalid(string: URLString, identifier: identifier).cocoaError } } } public func detectWebURL(fromString URLString: String) -> NSURL? { - var error: NSError? - let dataDetector = NSDataDetector(types: NSTextCheckingType.Link.rawValue, error: &error) + let dataDetector = try? NSDataDetector(types: NSTextCheckingType.Link.rawValue) - if let result = dataDetector?.firstMatchInString(URLString, options: NSMatchingOptions.allZeros, range: NSMakeRange(0, (URLString as NSString).length)) { + if let result = dataDetector?.firstMatchInString(URLString, options: NSMatchingOptions(), range: NSMakeRange(0, (URLString as NSString).length)) { return result.URL } else {