Chore: upgrade deps

This commit is contained in:
yichengchen 2019-05-10 20:31:24 +08:00
parent 26ded02881
commit 8a1a080bc8
111 changed files with 4002 additions and 4028 deletions

View File

@ -453,7 +453,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0940;
LastUpgradeCheck = 1000;
LastUpgradeCheck = 1020;
ORGANIZATIONNAME = west2online;
TargetAttributes = {
495A44BB20D2660A00888A0A = {
@ -584,15 +584,13 @@
files = (
);
inputPaths = (
"${SRCROOT}/Pods/Target Support Files/Pods-ClashX/Pods-ClashX-frameworks.sh",
"${PODS_ROOT}/Target Support Files/Pods-ClashX/Pods-ClashX-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/Alamofire/Alamofire.framework",
"${BUILT_PRODUCTS_DIR}/CocoaLumberjack/CocoaLumberjack.framework",
"${BUILT_PRODUCTS_DIR}/LetsMove/LetsMove.framework",
"${BUILT_PRODUCTS_DIR}/RxAtomic/RxAtomic.framework",
"${BUILT_PRODUCTS_DIR}/RxCocoa/RxCocoa.framework",
"${BUILT_PRODUCTS_DIR}/RxSwift/RxSwift.framework",
"${PODS_ROOT}/Sparkle/Sparkle.framework",
"${PODS_ROOT}/Sparkle/Sparkle.framework.dSYM",
"${BUILT_PRODUCTS_DIR}/SwiftyJSON/SwiftyJSON.framework",
"${BUILT_PRODUCTS_DIR}/WebViewJavascriptBridge/WebViewJavascriptBridge.framework",
"${BUILT_PRODUCTS_DIR}/Yams/Yams.framework",
@ -602,18 +600,16 @@
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Alamofire.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CocoaLumberjack.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/LetsMove.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxAtomic.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxCocoa.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxSwift.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Sparkle.framework",
"${DWARF_DSYM_FOLDER_PATH}/Sparkle.framework.dSYM",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwiftyJSON.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/WebViewJavascriptBridge.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Yams.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-ClashX/Pods-ClashX-frameworks.sh\"\n";
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-ClashX/Pods-ClashX-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
@ -733,7 +729,7 @@
buildSettings = {
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = ClashXLaunchHelper/ClashXLaunchHelper.entitlements;
CODE_SIGN_IDENTITY = "Developer ID Application";
CODE_SIGN_IDENTITY = "Mac Developer";
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
DEVELOPMENT_TEAM = MEWHFZ92DY;
@ -906,7 +902,7 @@
baseConfigurationReference = A1485BCE642059532D01B8BA /* Pods-ClashX.release.xcconfig */;
buildSettings = {
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "Developer ID Application";
CODE_SIGN_IDENTITY = "Mac Developer";
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
DEVELOPMENT_TEAM = MEWHFZ92DY;

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1000"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"

View File

@ -1,21 +1,19 @@
PODS:
- Alamofire (4.8.1)
- CocoaLumberjack/Core (3.5.2)
- CocoaLumberjack/Swift (3.5.2):
- Alamofire (4.8.2)
- CocoaLumberjack/Core (3.5.3)
- CocoaLumberjack/Swift (3.5.3):
- CocoaLumberjack/Core
- Crashlytics (3.12.0):
- Fabric (~> 1.9.0)
- Fabric (1.9.0)
- LetsMove (1.24)
- RxAtomic (4.4.2)
- RxCocoa (4.4.2):
- RxCocoa (4.5.0):
- RxSwift (>= 4.4.2, ~> 4.4)
- RxSwift (4.4.2):
- RxAtomic (>= 4.4.2, ~> 4.4)
- RxSwift (4.5.0)
- Sparkle (1.21.3)
- SwiftyJSON (4.2.0)
- SwiftyJSON (4.3.0)
- WebViewJavascriptBridge (6.0.3)
- Yams (1.0.1)
- Yams (2.0.0)
DEPENDENCIES:
- Alamofire (~> 4.7)
@ -37,7 +35,6 @@ SPEC REPOS:
- Crashlytics
- Fabric
- LetsMove
- RxAtomic
- RxCocoa
- RxSwift
- Sparkle
@ -46,19 +43,18 @@ SPEC REPOS:
- Yams
SPEC CHECKSUMS:
Alamofire: 16ce2c353fb72865124ddae8a57c5942388f4f11
CocoaLumberjack: 118bf4a820efc641f79fa487b75ed928dccfae23
Alamofire: ae5c501addb7afdbb13687d7f2f722c78734c2d3
CocoaLumberjack: 2f44e60eb91c176d471fdba43b9e3eae6a721947
Crashlytics: 07fb167b1694128c1c9a5a5cc319b0e9c3ca0933
Fabric: f988e33c97f08930a413e08123064d2e5f68d655
LetsMove: fefe56bc7bc7fb7d37049e28a14f297961229fc5
RxAtomic: d00e97c10db88c6f08540e0bf2752fc5a2404167
RxCocoa: 477990dc3b4c3ff55fb0ac77e1cc06244e0aaec8
RxSwift: 74c29b693c8e42b0f64400e8b06564575742d649
RxCocoa: cbf70265dc65a981d4ac982e513c10cf23df24a0
RxSwift: f172070dfd1a93d70a9ab97a5a01166206e1c575
Sparkle: 3f75576db8b0265adef36c43249d747f22d0b708
SwiftyJSON: c4bcba26dd9ec7a027fc8eade48e2c911f229e96
SwiftyJSON: 6faa0040f8b59dead0ee07436cbf76b73c08fd08
WebViewJavascriptBridge: 7f5bc4d3581e672e8f32bd0f812d54bc69bb8e29
Yams: 572f625a8b719b73e0b57fd313c680f3e2161fe9
Yams: cb96472112d99e4b368f8dae9ab62e8a3eb8a3f9
PODFILE CHECKSUM: 8f4cf54b06edff20db9edc64fb89d5886c1cdf83
COCOAPODS: 1.5.3
COCOAPODS: 1.6.1

View File

@ -98,7 +98,7 @@ open class MultipartFormData {
public var contentLength: UInt64 { return bodyParts.reduce(0) { $0 + $1.bodyContentLength } }
/// The boundary used to separate the body parts in the encoded form data.
public let boundary: String
public var boundary: String
private var bodyParts: [BodyPart]
private var bodyPartError: AFError?

View File

@ -13,7 +13,7 @@
// to endorse or promote products derived from this software without specific
// prior written permission of Deusty, LLC.
#import "DDASLLogger.h"
#import <CocoaLumberjack/DDASLLogger.h>
@protocol DDLogger;

View File

@ -70,7 +70,7 @@ static DDLogLevel _captureLevel = DDLogLevelVerbose;
#if !TARGET_OS_IPHONE || (defined(TARGET_SIMULATOR) && TARGET_SIMULATOR)
int processId = [[NSProcessInfo processInfo] processIdentifier];
char pid[16];
sprintf(pid, "%d", processId);
snprintf(pid, sizeof(pid), "%d", processId);
asl_set_query(query, ASL_KEY_PID, pid, ASL_QUERY_OP_EQUAL | ASL_QUERY_OP_NUMERIC);
#endif
}

View File

@ -20,7 +20,7 @@
#define DD_LEGACY_MACROS 0
#endif
#import "DDLog.h"
#import <CocoaLumberjack/DDLog.h>
// Custom key set on messages sent to ASL
extern const char* const kDDASLKeyDDLog;

View File

@ -18,7 +18,7 @@
#define DD_LEGACY_MACROS 0
#endif
#import "DDLog.h"
#import <CocoaLumberjack/DDLog.h>
/**
* This class provides an abstract implementation of a database logger.

View File

@ -26,8 +26,8 @@
@inlinable
public func DDAssert(_ condition: @autoclosure () -> Bool, _ message: @autoclosure () -> String = "", level: DDLogLevel = DDDefaultLogLevel, context: Int = 0, file: StaticString = #file, function: StaticString = #function, line: UInt = #line, tag: Any? = nil, asynchronous async: Bool = false, ddlog: DDLog = DDLog.sharedInstance) {
if !condition() {
DDLogError(message, level: level, context: context, file: file, function: function, line: line, tag: tag, asynchronous: async, ddlog: ddlog)
Swift.assertionFailure(message, file: file, line: line)
DDLogError(message(), level: level, context: context, file: file, function: function, line: line, tag: tag, asynchronous: async, ddlog: ddlog)
Swift.assertionFailure(message(), file: file, line: line)
}
}
@ -40,6 +40,6 @@ public func DDAssert(_ condition: @autoclosure () -> Bool, _ message: @autoclosu
*/
@inlinable
public func DDAssertionFailure(_ message: @autoclosure () -> String = "", level: DDLogLevel = DDDefaultLogLevel, context: Int = 0, file: StaticString = #file, function: StaticString = #function, line: UInt = #line, tag: Any? = nil, asynchronous async: Bool = false, ddlog: DDLog = DDLog.sharedInstance) {
DDLogError(message, level: level, context: context, file: file, function: function, line: line, tag: tag, asynchronous: async, ddlog: ddlog)
Swift.assertionFailure(message, file: file, line: line)
DDLogError(message(), level: level, context: context, file: file, function: function, line: line, tag: tag, asynchronous: async, ddlog: ddlog)
Swift.assertionFailure(message(), file: file, line: line)
}

View File

@ -20,7 +20,7 @@
if (!(condition)) { \
NSString *description = [NSString stringWithFormat:frmt, ## __VA_ARGS__]; \
DDLogError(@"%@", description); \
NSAssert(NO, description); \
NSAssert(NO, @"%@", description); \
}
#define DDAssertCondition(condition) DDAssert(condition, @"Condition not satisfied: %s", #condition)

View File

@ -13,7 +13,7 @@
// to endorse or promote products derived from this software without specific
// prior written permission of Deusty, LLC.
#import "CocoaLumberjack.h"
#import <CocoaLumberjack/CocoaLumberjack.h>
NS_ASSUME_NONNULL_BEGIN

View File

@ -18,7 +18,7 @@
#define DD_LEGACY_MACROS 0
#endif
#import "DDLog.h"
#import <CocoaLumberjack/DDLog.h>
NS_ASSUME_NONNULL_BEGIN

View File

@ -826,7 +826,7 @@ unsigned long long const kDDDefaultLogFilesDiskQuota = 20 * 1024 * 1024; // 20
});
#endif
static NSTimeInterval const kDDMaxTimerDelay = LONG_LONG_MAX / NSEC_PER_SEC;
static NSTimeInterval const kDDMaxTimerDelay = LLONG_MAX / NSEC_PER_SEC;
int64_t delay = (int64_t)(MIN([logFileRollingDate timeIntervalSinceNow], kDDMaxTimerDelay) * (NSTimeInterval) NSEC_PER_SEC);
dispatch_time_t fireTime = dispatch_time(DISPATCH_TIME_NOW, delay);

View File

@ -18,7 +18,7 @@
#define DD_LEGACY_MACROS 0
#endif
#import "DDLog.h"
#import <CocoaLumberjack/DDLog.h>
/**
* The constant/variable/method responsible for controlling the current log level.

View File

@ -20,10 +20,10 @@
#define DD_LEGACY_MACROS 1
#endif
// DD_LEGACY_MACROS is checked in the file itself
#import "DDLegacyMacros.h"
#import <CocoaLumberjack/DDLegacyMacros.h>
// Names of loggers.
#import "DDLoggerNames.h"
#import <CocoaLumberjack/DDLoggerNames.h>
#if OS_OBJECT_USE_OBJC
#define DISPATCH_QUEUE_REFERENCE_TYPE strong

View File

@ -43,7 +43,7 @@
// We maintain the NS prefix on the macros to be explicit about the fact that we're using NSLog.
#ifndef DD_DEBUG
#define DD_DEBUG NO
#define DD_DEBUG 0
#endif
#define NSLogDebug(frmt, ...) do{ if(DD_DEBUG) NSLog((frmt), ##__VA_ARGS__); } while(0)
@ -619,7 +619,7 @@ static NSUInteger _numProcessors;
NSUInteger bufferSize = numClasses;
classes = numClasses ? (Class *)malloc(sizeof(Class) * bufferSize) : NULL;
classes = numClasses ? (Class *)calloc(bufferSize, sizeof(Class)) : NULL;
if (classes == NULL) {
return @[]; //no memory or classes?
}

View File

@ -18,7 +18,7 @@
#define DD_LEGACY_MACROS 0
#endif
#import "DDLog.h"
#import <CocoaLumberjack/DDLog.h>
/**
* The constant/variable/method responsible for controlling the current log level.

View File

@ -20,7 +20,7 @@
#define DD_LEGACY_MACROS 0
#endif
#import "DDLog.h"
#import <CocoaLumberjack/DDLog.h>
/**
* This class provides a logger for the Apple os_log facility.

View File

@ -18,7 +18,7 @@
#define DD_LEGACY_MACROS 0
#endif
#import "DDLog.h"
#import <CocoaLumberjack/DDLog.h>
#define LOG_CONTEXT_ALL INT_MAX
@ -31,7 +31,7 @@
static inline DDColor* DDMakeColor(CGFloat r, CGFloat g, CGFloat b) {return [DDColor colorWithRed:(r/255.0f) green:(g/255.0f) blue:(b/255.0f) alpha:1.0f];}
#elif defined(DD_CLI) || !__has_include(<AppKit/NSColor.h>)
// OS X CLI
#import "CLIColor.h"
#import <CocoaLumberjack/CLIColor.h>
typedef CLIColor DDColor;
static inline DDColor* DDMakeColor(CGFloat r, CGFloat g, CGFloat b) {return [DDColor colorWithCalibratedRed:(r/255.0f) green:(g/255.0f) blue:(b/255.0f) alpha:1.0f];}
#else

View File

@ -844,7 +844,7 @@ static DDTTYLogger *sharedInstance;
_appLen = [_appName lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
}
_app = (char *)malloc(_appLen + 1);
_app = (char *)calloc(_appLen + 1, sizeof(char));
if (_app == NULL) {
return nil;
@ -862,7 +862,7 @@ static DDTTYLogger *sharedInstance;
_processID = [NSString stringWithFormat:@"%i", (int)getpid()];
_pidLen = [_processID lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
_pid = (char *)malloc(_pidLen + 1);
_pid = (char *)calloc(_pidLen + 1, sizeof(char));
if (_pid == NULL) {
free(_app);
@ -1211,7 +1211,7 @@ static DDTTYLogger *sharedInstance;
const BOOL useStack = msgLen < (1024 * 4);
char msgStack[useStack ? (msgLen + 1) : 1]; // Analyzer doesn't like zero-size array, hence the 1
char *msg = useStack ? msgStack : (char *)malloc(msgLen + 1);
char *msg = useStack ? msgStack : (char *)calloc(msgLen + 1, sizeof(char));
if (msg == NULL) {
return;

View File

@ -20,7 +20,7 @@
#define DD_LEGACY_MACROS 0
#endif
#import "DDLog.h"
#import <CocoaLumberjack/DDLog.h>
/**
* This class provides a log formatter that filters log statements from a logging context not on the whitelist.

View File

@ -20,7 +20,7 @@
#define DD_LEGACY_MACROS 0
#endif
#import "DDLog.h"
#import <CocoaLumberjack/DDLog.h>
/**
* Log formatter mode

View File

@ -13,7 +13,7 @@
// to endorse or promote products derived from this software without specific
// prior written permission of Deusty, LLC.
#import "DDFileLogger.h"
#import <CocoaLumberjack/DDFileLogger.h>
NS_ASSUME_NONNULL_BEGIN

View File

@ -13,8 +13,8 @@
// to endorse or promote products derived from this software without specific
// prior written permission of Deusty, LLC.
#import "DDFileLogger+Buffering.h"
#import "DDFileLogger+Internal.h"
#import <CocoaLumberjack/DDFileLogger+Internal.h>
#import <CocoaLumberjack/DDFileLogger+Buffering.h>
#import <sys/mount.h>
@ -25,13 +25,16 @@ static const NSUInteger kDDMaxBufferSize = 1048576; // ~1 mB, f_iosize on iphone
// see statfs in sys/mount.h for descriptions of f_iosize and f_bsize.
// f_bsize == "default", and f_iosize == "max"
static inline NSUInteger p_DDGetDefaultBufferSizeBytesMax(const BOOL max) {
struct statfs *mntbufp = NULL;
int count = getmntinfo(&mntbufp, 0);
struct statfs *mountedFileSystems = NULL;
int count = getmntinfo(&mountedFileSystems, 0);
for (int i = 0; i < count; i++) {
const char *name = mntbufp[i].f_mntonname;
if (strlen(name) == 1 && *name == '/') {
return max ? mntbufp[i].f_iosize : mntbufp[i].f_bsize;
struct statfs mounted = mountedFileSystems[i];
const char *name = mounted.f_mntonname;
// We can use 2 as max here, since any length > 1 will fail the if-statement.
if (strnlen(name, 2) == 1 && *name == '/') {
return max ? (NSUInteger)mounted.f_iosize : (NSUInteger)mounted.f_bsize;
}
}

View File

@ -20,7 +20,7 @@
#define DD_LEGACY_MACROS 0
#endif
#import "DDLog.h"
#import <CocoaLumberjack/DDLog.h>
/**
* This formatter can be used to chain different formatters together.

View File

@ -151,14 +151,15 @@ Configure your logging however you want. Change log levels per file (perfect for
### Requirements
The current version of Lumberjack requires:
- Xcode 10 or later
- Swift 4.2 or later
- Xcode 10.2 or later
- Swift 5.0 or later
- iOS 8 or later
- OS X 10.10 or later
- WatchOS 3 or later
- TVOS 9 or later
#### Backwards compatibility
- for Xcode 10 and Swift 4.2, use the 3.5.2 version
- for iOS 6, iOS 7, OS X 10.8, OS 10.9 and Xcode 9, use the 3.4.2 version
- for iOS 5 and OS X 10.7, use the 3.3 version
- for Xcode 8 and Swift 3, use the 3.2 version

32
Pods/Manifest.lock generated
View File

@ -1,21 +1,19 @@
PODS:
- Alamofire (4.8.1)
- CocoaLumberjack/Core (3.5.2)
- CocoaLumberjack/Swift (3.5.2):
- Alamofire (4.8.2)
- CocoaLumberjack/Core (3.5.3)
- CocoaLumberjack/Swift (3.5.3):
- CocoaLumberjack/Core
- Crashlytics (3.12.0):
- Fabric (~> 1.9.0)
- Fabric (1.9.0)
- LetsMove (1.24)
- RxAtomic (4.4.2)
- RxCocoa (4.4.2):
- RxCocoa (4.5.0):
- RxSwift (>= 4.4.2, ~> 4.4)
- RxSwift (4.4.2):
- RxAtomic (>= 4.4.2, ~> 4.4)
- RxSwift (4.5.0)
- Sparkle (1.21.3)
- SwiftyJSON (4.2.0)
- SwiftyJSON (4.3.0)
- WebViewJavascriptBridge (6.0.3)
- Yams (1.0.1)
- Yams (2.0.0)
DEPENDENCIES:
- Alamofire (~> 4.7)
@ -37,7 +35,6 @@ SPEC REPOS:
- Crashlytics
- Fabric
- LetsMove
- RxAtomic
- RxCocoa
- RxSwift
- Sparkle
@ -46,19 +43,18 @@ SPEC REPOS:
- Yams
SPEC CHECKSUMS:
Alamofire: 16ce2c353fb72865124ddae8a57c5942388f4f11
CocoaLumberjack: 118bf4a820efc641f79fa487b75ed928dccfae23
Alamofire: ae5c501addb7afdbb13687d7f2f722c78734c2d3
CocoaLumberjack: 2f44e60eb91c176d471fdba43b9e3eae6a721947
Crashlytics: 07fb167b1694128c1c9a5a5cc319b0e9c3ca0933
Fabric: f988e33c97f08930a413e08123064d2e5f68d655
LetsMove: fefe56bc7bc7fb7d37049e28a14f297961229fc5
RxAtomic: d00e97c10db88c6f08540e0bf2752fc5a2404167
RxCocoa: 477990dc3b4c3ff55fb0ac77e1cc06244e0aaec8
RxSwift: 74c29b693c8e42b0f64400e8b06564575742d649
RxCocoa: cbf70265dc65a981d4ac982e513c10cf23df24a0
RxSwift: f172070dfd1a93d70a9ab97a5a01166206e1c575
Sparkle: 3f75576db8b0265adef36c43249d747f22d0b708
SwiftyJSON: c4bcba26dd9ec7a027fc8eade48e2c911f229e96
SwiftyJSON: 6faa0040f8b59dead0ee07436cbf76b73c08fd08
WebViewJavascriptBridge: 7f5bc4d3581e672e8f32bd0f812d54bc69bb8e29
Yams: 572f625a8b719b73e0b57fd313c680f3e2161fe9
Yams: cb96472112d99e4b368f8dae9ab62e8a3eb8a3f9
PODFILE CHECKSUM: 8f4cf54b06edff20db9edc64fb89d5886c1cdf83
COCOAPODS: 1.5.3
COCOAPODS: 1.6.1

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +0,0 @@
**The MIT License**
**Copyright © 2015 Krunoslav Zaher**
**All rights reserved.**
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

217
Pods/RxAtomic/README.md generated
View File

@ -1,217 +0,0 @@
<img src="https://raw.githubusercontent.com/ReactiveX/RxSwift/master/assets/Rx_Logo_M.png" alt="Miss Electric Eel 2016" width="36" height="36"> RxSwift: ReactiveX for Swift
======================================
[![Travis CI](https://travis-ci.org/ReactiveX/RxSwift.svg?branch=master)](https://travis-ci.org/ReactiveX/RxSwift) ![platforms](https://img.shields.io/badge/platforms-iOS%20%7C%20macOS%20%7C%20tvOS%20%7C%20watchOS%20%7C%20Linux-333333.svg) [![pod](https://img.shields.io/cocoapods/v/RxSwift.svg)](https://cocoapods.org/pods/RxSwift) [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) [![Swift Package Manager compatible](https://img.shields.io/badge/Swift%20Package%20Manager-compatible-brightgreen.svg)](https://github.com/apple/swift-package-manager)
* RxSwift 3.x / Swift 3.x can be found in [**rxswift-3.0** branch](https://github.com/ReactiveX/RxSwift/tree/rxswift-3.0).
Rx is a [generic abstraction of computation](https://youtu.be/looJcaeboBY) expressed through `Observable<Element>` interface.
This is a Swift version of [Rx](https://github.com/Reactive-Extensions/Rx.NET).
It tries to port as many concepts from the original version as possible, but some concepts were adapted for more pleasant and performant integration with iOS/macOS environment.
Cross platform documentation can be found on [ReactiveX.io](http://reactivex.io/).
Like the original Rx, its intention is to enable easy composition of asynchronous operations and event/data streams.
KVO observing, async operations and streams are all unified under [abstraction of sequence](Documentation/GettingStarted.md#observables-aka-sequences). This is the reason why Rx is so simple, elegant and powerful.
## I came here because I want to ...
###### ... understand
* [why use rx?](Documentation/Why.md)
* [the basics, getting started with RxSwift](Documentation/GettingStarted.md)
* [traits](Documentation/Traits.md) - what are `Single`, `Completable`, `Maybe`, `Driver`, and `ControlProperty` ... and why do they exist?
* [testing](Documentation/UnitTests.md)
* [tips and common errors](Documentation/Tips.md)
* [debugging](Documentation/GettingStarted.md#debugging)
* [the math behind Rx](Documentation/MathBehindRx.md)
* [what are hot and cold observable sequences?](Documentation/HotAndColdObservables.md)
###### ... install
* Integrate RxSwift/RxCocoa with my app. [Installation Guide](#installation)
###### ... hack around
* with the example app. [Running Example App](Documentation/ExampleApp.md)
* with operators in playgrounds. [Playgrounds](Documentation/Playgrounds.md)
###### ... interact
* All of this is great, but it would be nice to talk with other people using RxSwift and exchange experiences. <br />[![Slack channel](http://rxswift-slack.herokuapp.com/badge.svg)](http://slack.rxswift.org) [Join Slack Channel](http://slack.rxswift.org)
* Report a problem using the library. [Open an Issue With Bug Template](.github/ISSUE_TEMPLATE.md)
* Request a new feature. [Open an Issue With Feature Request Template](Documentation/NewFeatureRequestTemplate.md)
* Help out [Check out contribution guide](CONTRIBUTING.md)
###### ... compare
* [with other libraries](Documentation/ComparisonWithOtherLibraries.md).
###### ... find compatible
* libraries from [RxSwiftCommunity](https://github.com/RxSwiftCommunity).
* [Pods using RxSwift](https://cocoapods.org/?q=uses%3Arxswift).
###### ... see the broader vision
* Does this exist for Android? [RxJava](https://github.com/ReactiveX/RxJava)
* Where is all of this going, what is the future, what about reactive architectures, how do you design entire apps this way? [Cycle.js](https://github.com/cyclejs/cycle-core) - this is javascript, but [RxJS](https://github.com/Reactive-Extensions/RxJS) is javascript version of Rx.
## Usage
<table>
<tr>
<th width="30%">Here's an example</th>
<th width="30%">In Action</th>
</tr>
<tr>
<td>Define search for GitHub repositories ...</td>
<th rowspan="9"><img src="https://raw.githubusercontent.com/kzaher/rxswiftcontent/master/GithubSearch.gif"></th>
</tr>
<tr>
<td><div class="highlight highlight-source-swift"><pre>
let searchResults = searchBar.rx.text.orEmpty
.throttle(0.3, scheduler: MainScheduler.instance)
.distinctUntilChanged()
.flatMapLatest { query -> Observable&lt;[Repository]&gt; in
if query.isEmpty {
return .just([])
}
return searchGitHub(query)
.catchErrorJustReturn([])
}
.observeOn(MainScheduler.instance)</pre></div></td>
</tr>
<tr>
<td>... then bind the results to your tableview</td>
</tr>
<tr>
<td width="30%"><div class="highlight highlight-source-swift"><pre>
searchResults
.bind(to: tableView.rx.items(cellIdentifier: "Cell")) {
(index, repository: Repository, cell) in
cell.textLabel?.text = repository.name
cell.detailTextLabel?.text = repository.url
}
.disposed(by: disposeBag)</pre></div></td>
</tr>
</table>
## Requirements
* Xcode 9.0
* Swift 4.0
* Swift 3.x ([use `rxswift-3.0` branch](https://github.com/ReactiveX/RxSwift/tree/rxswift-3.0) instead)
* Swift 2.3 ([use `rxswift-2.0` branch](https://github.com/ReactiveX/RxSwift/tree/rxswift-2.0) instead)
## Installation
Rx doesn't contain any external dependencies.
These are currently the supported options:
### Manual
Open Rx.xcworkspace, choose `RxExample` and hit run. This method will build everything and run the sample app
### [CocoaPods](https://guides.cocoapods.org/using/using-cocoapods.html)
**Tested with `pod --version`: `1.3.1`**
```ruby
# Podfile
use_frameworks!
target 'YOUR_TARGET_NAME' do
pod 'RxSwift', '~> 4.0'
pod 'RxCocoa', '~> 4.0'
end
# RxTest and RxBlocking make the most sense in the context of unit/integration tests
target 'YOUR_TESTING_TARGET' do
pod 'RxBlocking', '~> 4.0'
pod 'RxTest', '~> 4.0'
end
```
Replace `YOUR_TARGET_NAME` and then, in the `Podfile` directory, type:
```bash
$ pod install
```
### [Carthage](https://github.com/Carthage/Carthage)
**Tested with `carthage version`: `0.26.2`**
Add this to `Cartfile`
```
github "ReactiveX/RxSwift" ~> 4.0
```
```bash
$ carthage update
```
### [Swift Package Manager](https://github.com/apple/swift-package-manager)
**Tested with `swift build --version`: `Swift 4.0.0-dev (swiftpm-13126)`**
Create a `Package.swift` file.
```swift
// swift-tools-version:4.0
import PackageDescription
let package = Package(
name: "RxTestProject",
dependencies: [
.package(url: "https://github.com/ReactiveX/RxSwift.git", "4.0.0" ..< "5.0.0")
],
targets: [
.target(name: "RxTestProject", dependencies: ["RxSwift", "RxCocoa"])
]
)
```
```bash
$ swift build
```
To build or test a module with RxTest dependency, set `TEST=1`. ([RxSwift >= 3.4.2](https://github.com/ReactiveX/RxSwift/releases/tag/3.4.2))
```bash
$ TEST=1 swift test
```
### Manually using git submodules
* Add RxSwift as a submodule
```bash
$ git submodule add git@github.com:ReactiveX/RxSwift.git
```
* Drag `Rx.xcodeproj` into Project Navigator
* Go to `Project > Targets > Build Phases > Link Binary With Libraries`, click `+` and select `RxSwift-[Platform]` and `RxCocoa-[Platform]` targets
## References
* [http://reactivex.io/](http://reactivex.io/)
* [Reactive Extensions GitHub (GitHub)](https://github.com/Reactive-Extensions)
* [RxSwift RayWenderlich.com Book](https://store.raywenderlich.com/products/rxswift-reactive-programming-with-swift)
* [Boxue.io RxSwift Online Course](https://boxueio.com/series/rxswift-101) (Chinese 🇨🇳)
* [Erik Meijer (Wikipedia)](http://en.wikipedia.org/wiki/Erik_Meijer_%28computer_scientist%29)
* [Expert to Expert: Brian Beckman and Erik Meijer - Inside the .NET Reactive Framework (Rx) (video)](https://youtu.be/looJcaeboBY)
* [Reactive Programming Overview (Jafar Husain from Netflix)](https://www.youtube.com/watch?v=dwP1TNXE6fc)
* [Subject/Observer is Dual to Iterator (paper)](http://csl.stanford.edu/~christos/pldi2010.fit/meijer.duality.pdf)
* [Rx standard sequence operators visualized (visualization tool)](http://rxmarbles.com/)
* [Haskell](https://www.haskell.org/)

View File

@ -1,7 +0,0 @@
//
// RxAtomic.c
// RxAtomic
//
// Created by Krunoslav Zaher on 10/28/18.
// Copyright © 2018 Krunoslav Zaher. All rights reserved.
//

View File

@ -1,73 +0,0 @@
//
// RxAtomic.h
// RxAtomic
//
// Created by Krunoslav Zaher on 10/28/18.
// Copyright © 2018 Krunoslav Zaher. All rights reserved.
//
#ifndef RxAtomic_h
#define RxAtomic_h
#include <stdatomic.h>
#define SWIFT_NAME(_name) __attribute__((swift_name(#_name)))
#define Atomic(swift_type, llvm_type) \
typedef struct { volatile atomic_##llvm_type atom; } Atomic##swift_type;\
static __inline__ __attribute__((__always_inline__)) SWIFT_NAME(Atomic##swift_type.initialize(_:_:)) \
void Atomic##swift_type##_Initialize(Atomic##swift_type * _Nonnull self, llvm_type value) { \
atomic_init(&self->atom, value);\
}\
\
static __inline__ __attribute__((__always_inline__)) SWIFT_NAME(Atomic##swift_type.load(_:)) \
llvm_type Atomic##swift_type##_Load(Atomic##swift_type * _Nonnull self) { \
return atomic_load(&self->atom);\
}\
\
static __inline__ __attribute__((__always_inline__)) SWIFT_NAME(Atomic##swift_type.fetchOr(_:_:)) \
llvm_type Atomic##swift_type##_FetchOr(Atomic##swift_type * _Nonnull self, llvm_type mask) { \
return atomic_fetch_or(&self->atom, mask);\
}\
\
static __inline__ __attribute__((__always_inline__)) SWIFT_NAME(Atomic##swift_type.add(_:_:)) \
llvm_type Atomic##swift_type##_Add(Atomic##swift_type * _Nonnull self, llvm_type value) { \
return atomic_fetch_add(&self->atom, value);\
}\
\
static __inline__ __attribute__((__always_inline__)) SWIFT_NAME(Atomic##swift_type.sub(_:_:)) \
llvm_type Atomic##swift_type##_Sub(Atomic##swift_type * _Nonnull self, llvm_type value) { \
return atomic_fetch_sub(&self->atom, value);\
}\
\
static __inline__ __attribute__((__always_inline__)) \
void Atomic##swift_type##_initialize(Atomic##swift_type * _Nonnull self, llvm_type value) { \
atomic_init(&self->atom, value);\
}\
\
static __inline__ __attribute__((__always_inline__)) \
llvm_type Atomic##swift_type##_load(Atomic##swift_type * _Nonnull self) { \
return atomic_load(&self->atom);\
}\
\
static __inline__ __attribute__((__always_inline__)) \
llvm_type Atomic##swift_type##_fetchOr(Atomic##swift_type * _Nonnull self, llvm_type mask) { \
return atomic_fetch_or(&self->atom, mask);\
}\
\
static __inline__ __attribute__((__always_inline__)) \
llvm_type Atomic##swift_type##_add(Atomic##swift_type * _Nonnull self, llvm_type value) { \
return atomic_fetch_add(&self->atom, value);\
}\
\
static __inline__ __attribute__((__always_inline__)) \
llvm_type Atomic##swift_type##_sub(Atomic##swift_type * _Nonnull self, llvm_type value) { \
return atomic_fetch_sub(&self->atom, value);\
}\
\
Atomic(Int, int)
#undef SWIFT_NAME
#endif /* RxAtomic_h */

View File

@ -171,9 +171,15 @@ extension Bag {
}
extension BagKey: Hashable {
#if swift(>=4.2)
func hash(into hasher: inout Hasher) {
hasher.combine(rawValue)
}
#else
var hashValue: Int {
return rawValue.hashValue
}
#endif
}
func ==(lhs: BagKey, rhs: BagKey) -> Bool {

View File

@ -41,7 +41,7 @@ KVO observing, async operations and streams are all unified under [abstraction o
###### ... interact
* All of this is great, but it would be nice to talk with other people using RxSwift and exchange experiences. <br />[![Slack channel](http://rxswift-slack.herokuapp.com/badge.svg)](http://slack.rxswift.org) [Join Slack Channel](http://slack.rxswift.org)
* All of this is great, but it would be nice to talk with other people using RxSwift and exchange experiences. <br />[Join Slack Channel](http://slack.rxswift.org)
* Report a problem using the library. [Open an Issue With Bug Template](.github/ISSUE_TEMPLATE.md)
* Request a new feature. [Open an Issue With Feature Request Template](Documentation/NewFeatureRequestTemplate.md)
* Help out [Check out contribution guide](CONTRIBUTING.md)

View File

@ -119,7 +119,18 @@ extension Reactive where Base: UISearchBar {
}
return ControlEvent(events: source)
}
/// Installs delegate as forwarding delegate on `delegate`.
/// Delegate won't be retained.
///
/// It enables using normal delegate mechanism with reactive delegate mechanism.
///
/// - parameter delegate: Delegate object.
/// - returns: Disposable object that can be used to unbind the delegate.
public func setDelegate(_ delegate: UISearchBarDelegate)
-> Disposable {
return RxSearchBarDelegateProxy.installForwardDelegate(delegate, retainDelegate: false, onProxyForObject: self.base)
}
}
#endif

View File

@ -6,53 +6,66 @@
// Copyright © 2018 Krunoslav Zaher. All rights reserved.
//
import RxAtomic
import class Foundation.NSLock
typealias AtomicInt = RxAtomic.AtomicInt
extension AtomicInt {
public init(_ value: Int32) {
self.init()
AtomicInt_initialize(&self, value)
final class AtomicInt: NSLock {
fileprivate var value: Int32
public init(_ value: Int32 = 0) {
self.value = value
}
}
@discardableResult
@inline(__always)
func add(_ this: UnsafeMutablePointer<AtomicInt>, _ value: Int32) -> Int32 {
return AtomicInt_add(this, value)
func add(_ this: AtomicInt, _ value: Int32) -> Int32 {
this.lock()
let oldValue = this.value
this.value += value
this.unlock()
return oldValue
}
@discardableResult
@inline(__always)
func sub(_ this: UnsafeMutablePointer<AtomicInt>, _ value: Int32) -> Int32 {
return AtomicInt_sub(this, value)
func sub(_ this: AtomicInt, _ value: Int32) -> Int32 {
this.lock()
let oldValue = this.value
this.value -= value
this.unlock()
return oldValue
}
@discardableResult
@inline(__always)
func fetchOr(_ this: UnsafeMutablePointer<AtomicInt>, _ mask: Int32) -> Int32 {
return AtomicInt_fetchOr(this, mask)
func fetchOr(_ this: AtomicInt, _ mask: Int32) -> Int32 {
this.lock()
let oldValue = this.value
this.value |= mask
this.unlock()
return oldValue
}
@inline(__always)
func load(_ this: UnsafeMutablePointer<AtomicInt>) -> Int32 {
return AtomicInt_load(this)
func load(_ this: AtomicInt) -> Int32 {
this.lock()
let oldValue = this.value
this.unlock()
return oldValue
}
@discardableResult
@inline(__always)
func increment(_ this: UnsafeMutablePointer<AtomicInt>) -> Int32 {
func increment(_ this: AtomicInt) -> Int32 {
return add(this, 1)
}
@discardableResult
@inline(__always)
func decrement(_ this: UnsafeMutablePointer<AtomicInt>) -> Int32 {
func decrement(_ this: AtomicInt) -> Int32 {
return sub(this, 1)
}
@inline(__always)
func isFlagSet(_ this: UnsafeMutablePointer<AtomicInt>, _ mask: Int32) -> Bool {
func isFlagSet(_ this: AtomicInt, _ mask: Int32) -> Bool {
return (load(this) & mask) != 0
}

View File

@ -171,9 +171,15 @@ extension Bag {
}
extension BagKey: Hashable {
#if swift(>=4.2)
func hash(into hasher: inout Hasher) {
hasher.combine(rawValue)
}
#else
var hashValue: Int {
return rawValue.hashValue
}
#endif
}
func ==(lhs: BagKey, rhs: BagKey) -> Bool {

View File

@ -41,7 +41,7 @@ KVO observing, async operations and streams are all unified under [abstraction o
###### ... interact
* All of this is great, but it would be nice to talk with other people using RxSwift and exchange experiences. <br />[![Slack channel](http://rxswift-slack.herokuapp.com/badge.svg)](http://slack.rxswift.org) [Join Slack Channel](http://slack.rxswift.org)
* All of this is great, but it would be nice to talk with other people using RxSwift and exchange experiences. <br />[Join Slack Channel](http://slack.rxswift.org)
* Report a problem using the library. [Open an Issue With Bug Template](.github/ISSUE_TEMPLATE.md)
* Request a new feature. [Open an Issue With Feature Request Template](Documentation/NewFeatureRequestTemplate.md)
* Help out [Check out contribution guide](CONTRIBUTING.md)

View File

@ -12,12 +12,12 @@
fileprivate final class AnonymousDisposable : DisposeBase, Cancelable {
public typealias DisposeAction = () -> Void
private var _isDisposed = AtomicInt(0)
private let _isDisposed = AtomicInt(0)
private var _disposeAction: DisposeAction?
/// - returns: Was resource disposed.
public var isDisposed: Bool {
return isFlagSet(&self._isDisposed, 1)
return isFlagSet(self._isDisposed, 1)
}
/// Constructs a new disposable with the given action used for disposal.
@ -38,7 +38,7 @@ fileprivate final class AnonymousDisposable : DisposeBase, Cancelable {
///
/// After invoking disposal action, disposal action will be dereferenced.
fileprivate func dispose() {
if fetchOr(&self._isDisposed, 1) == 0 {
if fetchOr(self._isDisposed, 1) == 0 {
if let action = self._disposeAction {
self._disposeAction = nil
action()

View File

@ -9,7 +9,7 @@
/// Represents two disposable resources that are disposed together.
private final class BinaryDisposable : DisposeBase, Cancelable {
private var _isDisposed = AtomicInt(0)
private let _isDisposed = AtomicInt(0)
// state
private var _disposable1: Disposable?
@ -17,7 +17,7 @@ private final class BinaryDisposable : DisposeBase, Cancelable {
/// - returns: Was resource disposed.
var isDisposed: Bool {
return isFlagSet(&self._isDisposed, 1)
return isFlagSet(self._isDisposed, 1)
}
/// Constructs new binary disposable from two disposables.
@ -34,7 +34,7 @@ private final class BinaryDisposable : DisposeBase, Cancelable {
///
/// After invoking disposal action, disposal action will be dereferenced.
func dispose() {
if fetchOr(&self._isDisposed, 1) == 0 {
if fetchOr(self._isDisposed, 1) == 0 {
self._disposable1?.dispose()
self._disposable2?.dispose()
self._disposable1 = nil

View File

@ -97,7 +97,7 @@ public final class RefCountDisposable : DisposeBase, Cancelable {
internal final class RefCountInnerDisposable: DisposeBase, Disposable
{
private let _parent: RefCountDisposable
private var _isDisposed = AtomicInt(0)
private let _isDisposed = AtomicInt(0)
init(_ parent: RefCountDisposable) {
self._parent = parent
@ -106,7 +106,7 @@ internal final class RefCountInnerDisposable: DisposeBase, Disposable
internal func dispose()
{
if fetchOr(&self._isDisposed, 1) == 0 {
if fetchOr(self._isDisposed, 1) == 0 {
self._parent.release()
}
}

View File

@ -15,14 +15,14 @@ private let disposeScheduledDisposable: (ScheduledDisposable) -> Disposable = {
public final class ScheduledDisposable : Cancelable {
public let scheduler: ImmediateSchedulerType
private var _isDisposed = AtomicInt(0)
private let _isDisposed = AtomicInt(0)
// state
private var _disposable: Disposable?
/// - returns: Was resource disposed.
public var isDisposed: Bool {
return isFlagSet(&self._isDisposed, 1)
return isFlagSet(self._isDisposed, 1)
}
/**
@ -42,7 +42,7 @@ public final class ScheduledDisposable : Cancelable {
}
func disposeInner() {
if fetchOr(&self._isDisposed, 1) == 0 {
if fetchOr(self._isDisposed, 1) == 0 {
self._disposable!.dispose()
self._disposable = nil
}

View File

@ -19,12 +19,12 @@ public final class SingleAssignmentDisposable : DisposeBase, Cancelable {
}
// state
private var _state = AtomicInt(0)
private let _state = AtomicInt(0)
private var _disposable = nil as Disposable?
/// - returns: A value that indicates whether the object is disposed.
public var isDisposed: Bool {
return isFlagSet(&self._state, DisposeState.disposed.rawValue)
return isFlagSet(self._state, DisposeState.disposed.rawValue)
}
/// Initializes a new instance of the `SingleAssignmentDisposable`.
@ -38,7 +38,7 @@ public final class SingleAssignmentDisposable : DisposeBase, Cancelable {
public func setDisposable(_ disposable: Disposable) {
self._disposable = disposable
let previousState = fetchOr(&self._state, DisposeState.disposableSet.rawValue)
let previousState = fetchOr(self._state, DisposeState.disposableSet.rawValue)
if (previousState & DisposeState.disposableSet.rawValue) != 0 {
rxFatalError("oldState.disposable != nil")
@ -52,7 +52,7 @@ public final class SingleAssignmentDisposable : DisposeBase, Cancelable {
/// Disposes the underlying disposable.
public func dispose() {
let previousState = fetchOr(&self._state, DisposeState.disposed.rawValue)
let previousState = fetchOr(self._state, DisposeState.disposed.rawValue)
if (previousState & DisposeState.disposed.rawValue) != 0 {
return

View File

@ -27,7 +27,7 @@ final private class AnonymousObservableSink<O: ObserverType>: Sink<O>, ObserverT
typealias Parent = AnonymousObservable<E>
// state
private var _isStopped = AtomicInt(0)
private let _isStopped = AtomicInt(0)
#if DEBUG
fileprivate let _synchronizationTracker = SynchronizationTracker()
@ -44,12 +44,12 @@ final private class AnonymousObservableSink<O: ObserverType>: Sink<O>, ObserverT
#endif
switch event {
case .next:
if load(&self._isStopped) == 1 {
if load(self._isStopped) == 1 {
return
}
self.forwardOn(event)
case .error, .completed:
if fetchOr(&self._isStopped, 1) == 0 {
if fetchOr(self._isStopped, 1) == 0 {
self.forwardOn(event)
self.dispose()
}

View File

@ -58,10 +58,10 @@ final private class MapSink<SourceType, O: ObserverType>: Sink<O>, ObserverType
}
#if TRACE_RESOURCES
fileprivate var _numberOfMapOperators = AtomicInt(0)
fileprivate let _numberOfMapOperators = AtomicInt(0)
extension Resources {
public static var numberOfMapOperators: Int32 {
return load(&_numberOfMapOperators)
return load(_numberOfMapOperators)
}
}
#endif
@ -82,7 +82,7 @@ final private class Map<SourceType, ResultType>: Producer<ResultType> {
self._transform = transform
#if TRACE_RESOURCES
_ = increment(&_numberOfMapOperators)
_ = increment(_numberOfMapOperators)
#endif
}
@ -102,7 +102,7 @@ final private class Map<SourceType, ResultType>: Producer<ResultType> {
#if TRACE_RESOURCES
deinit {
_ = decrement(&_numberOfMapOperators)
_ = decrement(_numberOfMapOperators)
}
#endif
}

View File

@ -156,7 +156,7 @@ final private class Connection<S: SubjectType>: ObserverType, Disposable {
private var _subscription : Disposable?
private var _subjectObserver: S.SubjectObserverType
private var _disposed = AtomicInt(0)
private let _disposed = AtomicInt(0)
init(parent: ConnectableObservableAdapter<S>, subjectObserver: S.SubjectObserverType, lock: RecursiveLock, subscription: Disposable) {
self._parent = parent
@ -166,7 +166,7 @@ final private class Connection<S: SubjectType>: ObserverType, Disposable {
}
func on(_ event: Event<S.SubjectObserverType.E>) {
if isFlagSet(&self._disposed, 1) {
if isFlagSet(self._disposed, 1) {
return
}
if event.isStopEvent {
@ -177,7 +177,7 @@ final private class Connection<S: SubjectType>: ObserverType, Disposable {
func dispose() {
_lock.lock(); defer { _lock.unlock() } // {
fetchOr(&self._disposed, 1)
fetchOr(self._disposed, 1)
guard let parent = _parent else {
return
}

View File

@ -151,7 +151,7 @@ final private class ObserveOnSink<O: ObserverType>: ObserverBase<O.E> {
}
#if TRACE_RESOURCES
fileprivate var _numberOfSerialDispatchQueueObservables = AtomicInt(0)
fileprivate let _numberOfSerialDispatchQueueObservables = AtomicInt(0)
extension Resources {
/**
Counts number of `SerialDispatchQueueObservables`.
@ -159,7 +159,7 @@ final private class ObserveOnSink<O: ObserverType>: ObserverBase<O.E> {
Purposed for unit tests.
*/
public static var numberOfSerialDispatchQueueObservables: Int32 {
return load(&_numberOfSerialDispatchQueueObservables)
return load(_numberOfSerialDispatchQueueObservables)
}
}
#endif
@ -212,7 +212,7 @@ final private class ObserveOnSerialDispatchQueue<E>: Producer<E> {
#if TRACE_RESOURCES
_ = Resources.incrementTotal()
_ = increment(&_numberOfSerialDispatchQueueObservables)
_ = increment(_numberOfSerialDispatchQueueObservables)
#endif
}
@ -225,7 +225,7 @@ final private class ObserveOnSerialDispatchQueue<E>: Producer<E> {
#if TRACE_RESOURCES
deinit {
_ = Resources.decrementTotal()
_ = decrement(&_numberOfSerialDispatchQueueObservables)
_ = decrement(_numberOfSerialDispatchQueueObservables)
}
#endif
}

View File

@ -42,19 +42,19 @@ fileprivate final class SinkDisposer: Cancelable {
case sinkAndSubscriptionSet = 2
}
private var _state = AtomicInt(0)
private let _state = AtomicInt(0)
private var _sink: Disposable?
private var _subscription: Disposable?
var isDisposed: Bool {
return isFlagSet(&self._state, DisposeState.disposed.rawValue)
return isFlagSet(self._state, DisposeState.disposed.rawValue)
}
func setSinkAndSubscription(sink: Disposable, subscription: Disposable) {
self._sink = sink
self._subscription = subscription
let previousState = fetchOr(&self._state, DisposeState.sinkAndSubscriptionSet.rawValue)
let previousState = fetchOr(self._state, DisposeState.sinkAndSubscriptionSet.rawValue)
if (previousState & DisposeState.sinkAndSubscriptionSet.rawValue) != 0 {
rxFatalError("Sink and subscription were already set")
}
@ -68,7 +68,7 @@ fileprivate final class SinkDisposer: Cancelable {
}
func dispose() {
let previousState = fetchOr(&self._state, DisposeState.disposed.rawValue)
let previousState = fetchOr(self._state, DisposeState.disposed.rawValue)
if (previousState & DisposeState.disposed.rawValue) != 0 {
return

View File

@ -9,7 +9,7 @@
class Sink<O : ObserverType> : Disposable {
fileprivate let _observer: O
fileprivate let _cancel: Cancelable
fileprivate var _disposed = AtomicInt(0)
fileprivate let _disposed = AtomicInt(0)
#if DEBUG
fileprivate let _synchronizationTracker = SynchronizationTracker()
@ -28,7 +28,7 @@ class Sink<O : ObserverType> : Disposable {
self._synchronizationTracker.register(synchronizationErrorMessage: .default)
defer { self._synchronizationTracker.unregister() }
#endif
if isFlagSet(&self._disposed, 1) {
if isFlagSet(self._disposed, 1) {
return
}
self._observer.on(event)
@ -39,11 +39,11 @@ class Sink<O : ObserverType> : Disposable {
}
final var disposed: Bool {
return isFlagSet(&self._disposed, 1)
return isFlagSet(self._disposed, 1)
}
func dispose() {
fetchOr(&self._disposed, 1)
fetchOr(self._disposed, 1)
self._cancel.dispose()
}

View File

@ -71,7 +71,13 @@ final class ZipSink2_<E1, E2, O: ObserverType> : ZipSink<O> {
rxFatalError("Unhandled case (Function)")
}
#if swift(>=4.2)
#if !compiler(>=5.0)
return false
#endif
#else
return false
#endif
}
func run() -> Disposable {
@ -183,7 +189,13 @@ final class ZipSink3_<E1, E2, E3, O: ObserverType> : ZipSink<O> {
rxFatalError("Unhandled case (Function)")
}
#if swift(>=4.2)
#if !compiler(>=5.0)
return false
#endif
#else
return false
#endif
}
func run() -> Disposable {
@ -303,7 +315,13 @@ final class ZipSink4_<E1, E2, E3, E4, O: ObserverType> : ZipSink<O> {
rxFatalError("Unhandled case (Function)")
}
#if swift(>=4.2)
#if !compiler(>=5.0)
return false
#endif
#else
return false
#endif
}
func run() -> Disposable {
@ -431,7 +449,13 @@ final class ZipSink5_<E1, E2, E3, E4, E5, O: ObserverType> : ZipSink<O> {
rxFatalError("Unhandled case (Function)")
}
#if swift(>=4.2)
#if !compiler(>=5.0)
return false
#endif
#else
return false
#endif
}
func run() -> Disposable {
@ -567,7 +591,13 @@ final class ZipSink6_<E1, E2, E3, E4, E5, E6, O: ObserverType> : ZipSink<O> {
rxFatalError("Unhandled case (Function)")
}
#if swift(>=4.2)
#if !compiler(>=5.0)
return false
#endif
#else
return false
#endif
}
func run() -> Disposable {
@ -711,7 +741,13 @@ final class ZipSink7_<E1, E2, E3, E4, E5, E6, E7, O: ObserverType> : ZipSink<O>
rxFatalError("Unhandled case (Function)")
}
#if swift(>=4.2)
#if !compiler(>=5.0)
return false
#endif
#else
return false
#endif
}
func run() -> Disposable {
@ -863,7 +899,13 @@ final class ZipSink8_<E1, E2, E3, E4, E5, E6, E7, E8, O: ObserverType> : ZipSink
rxFatalError("Unhandled case (Function)")
}
#if swift(>=4.2)
#if !compiler(>=5.0)
return false
#endif
#else
return false
#endif
}
func run() -> Disposable {

View File

@ -9,16 +9,16 @@
class ObserverBase<ElementType> : Disposable, ObserverType {
typealias E = ElementType
private var _isStopped = AtomicInt(0)
private let _isStopped = AtomicInt(0)
func on(_ event: Event<E>) {
switch event {
case .next:
if load(&self._isStopped) == 0 {
if load(self._isStopped) == 0 {
self.onCore(event)
}
case .error, .completed:
if fetchOr(&self._isStopped, 1) == 0 {
if fetchOr(self._isStopped, 1) == 0 {
self.onCore(event)
}
}
@ -29,6 +29,6 @@ class ObserverBase<ElementType> : Disposable, ObserverType {
}
func dispose() {
fetchOr(&self._isStopped, 1)
fetchOr(self._isStopped, 1)
}
}

View File

@ -7,27 +7,27 @@
//
#if TRACE_RESOURCES
fileprivate var resourceCount = AtomicInt(0)
fileprivate let resourceCount = AtomicInt(0)
/// Resource utilization information
public struct Resources {
/// Counts internal Rx resource allocations (Observables, Observers, Disposables, etc.). This provides a simple way to detect leaks during development.
public static var total: Int32 {
return load(&resourceCount)
return load(resourceCount)
}
/// Increments `Resources.total` resource count.
///
/// - returns: New resource count
public static func incrementTotal() -> Int32 {
return increment(&resourceCount)
return increment(resourceCount)
}
/// Decrements `Resources.total` resource count
///
/// - returns: New resource count
public static func decrementTotal() -> Int32 {
return decrement(&resourceCount)
return decrement(resourceCount)
}
}
#endif
@ -38,7 +38,6 @@ func rxAbstractMethod(file: StaticString = #file, line: UInt = #line) -> Swift.N
}
func rxFatalError(_ lastMessage: @autoclosure () -> String, file: StaticString = #file, line: UInt = #line) -> Swift.Never {
// The temptation to comment this line is great, but please don't, it's for your own good. The choice is yours.
fatalError(lastMessage(), file: file, line: line)
}

View File

@ -25,7 +25,7 @@ public final class MainScheduler : SerialDispatchQueueScheduler {
private let _mainQueue: DispatchQueue
var numberEnqueued = AtomicInt(0)
let numberEnqueued = AtomicInt(0)
/// Initializes new instance of `MainScheduler`.
public init() {
@ -57,11 +57,11 @@ public final class MainScheduler : SerialDispatchQueueScheduler {
}
override func scheduleInternal<StateType>(_ state: StateType, action: @escaping (StateType) -> Disposable) -> Disposable {
let previousNumberEnqueued = increment(&self.numberEnqueued)
let previousNumberEnqueued = increment(self.numberEnqueued)
if DispatchQueue.isMain && previousNumberEnqueued == 0 {
let disposable = action(state)
decrement(&self.numberEnqueued)
decrement(self.numberEnqueued)
return disposable
}
@ -72,7 +72,7 @@ public final class MainScheduler : SerialDispatchQueueScheduler {
_ = action(state)
}
decrement(&self.numberEnqueued)
decrement(self.numberEnqueued)
}
return cancel

View File

@ -21,7 +21,7 @@ final class SchedulePeriodicRecursive<State> {
private let _action: RecursiveAction
private var _state: State
private var _pendingTickCount = AtomicInt(0)
private let _pendingTickCount = AtomicInt(0)
init(scheduler: SchedulerType, startAfter: RxTimeInterval, period: RxTimeInterval, action: @escaping RecursiveAction, state: State) {
self._scheduler = scheduler
@ -45,14 +45,14 @@ final class SchedulePeriodicRecursive<State> {
// The idea is that if on tick there wasn't any item enqueued, schedule to perform work immediately.
// Else work will be scheduled after previous enqueued work completes.
if increment(&self._pendingTickCount) == 0 {
if increment(self._pendingTickCount) == 0 {
self.tick(.dispatchStart, scheduler: scheduler)
}
case .dispatchStart:
self._state = self._action(self._state)
// Start work and schedule check is this last batch of work
if decrement(&self._pendingTickCount) > 1 {
if decrement(self._pendingTickCount) > 1 {
// This gives priority to scheduler emulation, it's not perfect, but helps
scheduler.schedule(SchedulePeriodicRecursiveCommand.dispatchStart)
}

View File

@ -1,9 +1,15 @@
# SwiftyJSON
[![Travis CI](https://travis-ci.org/SwiftyJSON/SwiftyJSON.svg?branch=master)](https://travis-ci.org/SwiftyJSON/SwiftyJSON) [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) ![CocoaPods](https://img.shields.io/cocoapods/v/SwiftyJSON.svg) ![Platform](https://img.shields.io/badge/platforms-iOS%208.0+%20%7C%20macOS%2010.10+%20%7C%20tvOS%209.0+%20%7C%20watchOS%202.0+-333333.svg)
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) ![CocoaPods](https://img.shields.io/cocoapods/v/SwiftyJSON.svg) ![Platform](https://img.shields.io/badge/platforms-iOS%208.0%20%7C%20macOS%2010.10%20%7C%20tvOS%209.0%20%7C%20watchOS%203.0-F28D00.svg) [![Reviewed by Hound](https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg)](https://houndci.com)
SwiftyJSON makes it easy to deal with JSON data in Swift.
Platform | Build Status
---------| --------------|
*OS | [![Travis CI](https://travis-ci.org/SwiftyJSON/SwiftyJSON.svg?branch=master)](https://travis-ci.org/SwiftyJSON/SwiftyJSON) |
[Linux](https://github.com/IBM-Swift/SwiftyJSON) | [![Build Status](https://travis-ci.org/IBM-Swift/SwiftyJSON.svg?branch=master)](https://travis-ci.org/IBM-Swift/SwiftyJSON) |
1. [Why is the typical JSON handling in Swift NOT good](#why-is-the-typical-json-handling-in-swift-not-good)
2. [Requirements](#requirements)
3. [Integration](#integration)
@ -20,6 +26,7 @@ SwiftyJSON makes it easy to deal with JSON data in Swift.
- [Merging](#merging)
5. [Work with Alamofire](#work-with-alamofire)
6. [Work with Moya](#work-with-moya)
7. [SwiftyJSON Model Generator](#swiftyjson-model-generator)
> [中文介绍](http://tangplin.github.io/swiftyjson/)
@ -66,11 +73,12 @@ And don't worry about the Optional Wrapping thing. It's done for you automatical
```swift
let json = JSON(data: dataFromNetworking)
if let userName = json[999999]["wrong_key"]["wrong_name"].string {
let result = json[999999]["wrong_key"]["wrong_name"]
if let userName = result.string {
//Calm down, take it easy, the ".string" property still produces the correct Optional String type with safety
} else {
//Print the error
print(json[999999]["wrong_key"]["wrong_name"])
print(result.error)
}
```
@ -161,7 +169,7 @@ let name = json[0].double
```swift
// Getting an array of string from a JSON Array
let arrayNames = json["users"].arrayValue.map({$0["name"].stringValue})
let arrayNames = json["users"].arrayValue.map {$0["name"].stringValue}
```
```swift
@ -547,3 +555,8 @@ provider.request(.showProducts) { result in
}
```
## SwiftyJSON Model Generator
Tools to generate SwiftyJSON Models
* [JSON Cafe](http://www.jsoncafe.com/)
* [JSON Export](https://github.com/Ahmed-Ali/JSONExport)

View File

@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>4.4.2</string>
<string>4.8.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>

View File

@ -1,7 +1,7 @@
CODE_SIGN_IDENTITY =
CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Alamofire
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_ROOT = ${SRCROOT}

View File

@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>4.8.1</string>
<string>4.8.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>${PRODUCT_BUNDLE_IDENTIFIER}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>3.5.3</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>${CURRENT_PROJECT_VERSION}</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>

View File

@ -1,7 +1,7 @@
CODE_SIGN_IDENTITY =
CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/CocoaLumberjack
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_ROOT = ${SRCROOT}

View File

@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>3.5.2</string>
<string>3.5.3</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>

View File

@ -0,0 +1,11 @@
CODE_SIGN_IDENTITY =
CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Crashlytics
FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Crashlytics/OSX" "${PODS_ROOT}/Fabric/OSX"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
OTHER_LDFLAGS = $(inherited) -l"c++" -l"z" -framework "Security" -framework "SystemConfiguration"
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_ROOT = ${SRCROOT}
PODS_TARGET_SRCROOT = ${PODS_ROOT}/Crashlytics
PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
SKIP_INSTALL = YES

View File

@ -1,10 +1,10 @@
CODE_SIGN_IDENTITY =
CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/RxAtomic
DEFINES_MODULE = YES
CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Fabric
FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Fabric/OSX"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_ROOT = ${SRCROOT}
PODS_TARGET_SRCROOT = ${PODS_ROOT}/RxAtomic
PODS_TARGET_SRCROOT = ${PODS_ROOT}/Fabric
PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
SKIP_INSTALL = YES

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>${PRODUCT_BUNDLE_IDENTIFIER}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.24.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>${CURRENT_PROJECT_VERSION}</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>${PRODUCT_BUNDLE_IDENTIFIER}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>${CURRENT_PROJECT_VERSION}</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>

View File

@ -50,18 +50,6 @@ Fabric: Copyright 2018 Google, Inc. All Rights Reserved. Use of this software is
Fabric: Copyright 2018 Google, Inc. All Rights Reserved. Use of this software is subject to the terms and conditions of the Fabric Software and Services Agreement located at https://fabric.io/terms. OSS: http://get.fabric.io/terms/opensource.txt
## RxAtomic
**The MIT License**
**Copyright © 2015 Krunoslav Zaher**
**All rights reserved.**
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
## RxCocoa
**The MIT License**

View File

@ -95,24 +95,6 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</string>
<key>License</key>
<string>MIT</string>
<key>Title</key>
<string>RxAtomic</string>
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>FooterText</key>
<string>**The MIT License**
**Copyright © 2015 Krunoslav Zaher**
**All rights reserved.**
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</string>
<key>License</key>
<string>MIT</string>

View File

@ -3,10 +3,15 @@ set -e
set -u
set -o pipefail
function on_error {
echo "$(realpath -mq "${0}"):$1: error: Unexpected failure"
}
trap 'on_error $LINENO' ERR
if [ -z ${FRAMEWORKS_FOLDER_PATH+x} ]; then
# If FRAMEWORKS_FOLDER_PATH is not set, then there's nowhere for us to copy
# frameworks to, so exit 0 (signalling the script phase was successful).
exit 0
# If FRAMEWORKS_FOLDER_PATH is not set, then there's nowhere for us to copy
# frameworks to, so exit 0 (signalling the script phase was successful).
exit 0
fi
echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
@ -36,8 +41,8 @@ install_framework()
local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
if [ -L "${source}" ]; then
echo "Symlinked..."
source="$(readlink "${source}")"
echo "Symlinked..."
source="$(readlink "${source}")"
fi
# Use filter instead of exclude so missing patterns don't throw errors.
@ -47,8 +52,13 @@ install_framework()
local basename
basename="$(basename -s .framework "$1")"
binary="${destination}/${basename}.framework/${basename}"
if ! [ -r "$binary" ]; then
binary="${destination}/${basename}"
elif [ -L "${binary}" ]; then
echo "Destination binary is symlinked..."
dirname="$(dirname "${binary}")"
binary="${dirname}/$(readlink "${binary}")"
fi
# Strip invalid architectures so "fat" simulator / device frameworks work on device
@ -62,7 +72,7 @@ install_framework()
# Embed linked Swift runtime libraries. No longer necessary as of Xcode 7.
if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then
local swift_runtime_libs
swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]})
swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u)
for lib in $swift_runtime_libs; do
echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\""
rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}"
@ -101,8 +111,8 @@ install_dsym() {
# Signs a framework with the provided identity
code_sign_if_enabled() {
if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED:-}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then
# Use the current code_sign_identitiy
if [ -n "${EXPANDED_CODE_SIGN_IDENTITY:-}" -a "${CODE_SIGNING_REQUIRED:-}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then
# Use the current code_sign_identity
echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}"
local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS:-} --preserve-metadata=identifier,entitlements '$1'"
@ -131,7 +141,7 @@ strip_invalid_archs() {
for arch in $binary_archs; do
if ! [[ "${ARCHS}" == *"$arch"* ]]; then
# Strip non-valid architectures in-place
lipo -remove "$arch" -output "$binary" "$binary" || exit 1
lipo -remove "$arch" -output "$binary" "$binary"
stripped="$stripped $arch"
fi
done
@ -146,11 +156,9 @@ if [[ "$CONFIGURATION" == "Debug" ]]; then
install_framework "${BUILT_PRODUCTS_DIR}/Alamofire/Alamofire.framework"
install_framework "${BUILT_PRODUCTS_DIR}/CocoaLumberjack/CocoaLumberjack.framework"
install_framework "${BUILT_PRODUCTS_DIR}/LetsMove/LetsMove.framework"
install_framework "${BUILT_PRODUCTS_DIR}/RxAtomic/RxAtomic.framework"
install_framework "${BUILT_PRODUCTS_DIR}/RxCocoa/RxCocoa.framework"
install_framework "${BUILT_PRODUCTS_DIR}/RxSwift/RxSwift.framework"
install_framework "${PODS_ROOT}/Sparkle/Sparkle.framework"
install_dsym "${PODS_ROOT}/Sparkle/Sparkle.framework.dSYM"
install_framework "${BUILT_PRODUCTS_DIR}/SwiftyJSON/SwiftyJSON.framework"
install_framework "${BUILT_PRODUCTS_DIR}/WebViewJavascriptBridge/WebViewJavascriptBridge.framework"
install_framework "${BUILT_PRODUCTS_DIR}/Yams/Yams.framework"
@ -159,11 +167,9 @@ if [[ "$CONFIGURATION" == "Release" ]]; then
install_framework "${BUILT_PRODUCTS_DIR}/Alamofire/Alamofire.framework"
install_framework "${BUILT_PRODUCTS_DIR}/CocoaLumberjack/CocoaLumberjack.framework"
install_framework "${BUILT_PRODUCTS_DIR}/LetsMove/LetsMove.framework"
install_framework "${BUILT_PRODUCTS_DIR}/RxAtomic/RxAtomic.framework"
install_framework "${BUILT_PRODUCTS_DIR}/RxCocoa/RxCocoa.framework"
install_framework "${BUILT_PRODUCTS_DIR}/RxSwift/RxSwift.framework"
install_framework "${PODS_ROOT}/Sparkle/Sparkle.framework"
install_dsym "${PODS_ROOT}/Sparkle/Sparkle.framework.dSYM"
install_framework "${BUILT_PRODUCTS_DIR}/SwiftyJSON/SwiftyJSON.framework"
install_framework "${BUILT_PRODUCTS_DIR}/WebViewJavascriptBridge/WebViewJavascriptBridge.framework"
install_framework "${BUILT_PRODUCTS_DIR}/Yams/Yams.framework"

View File

@ -1,11 +1,11 @@
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES
CODE_SIGN_IDENTITY =
FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Sparkle" "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire" "${PODS_CONFIGURATION_BUILD_DIR}/CocoaLumberjack" "${PODS_CONFIGURATION_BUILD_DIR}/LetsMove" "${PODS_CONFIGURATION_BUILD_DIR}/RxAtomic" "${PODS_CONFIGURATION_BUILD_DIR}/RxCocoa" "${PODS_CONFIGURATION_BUILD_DIR}/RxSwift" "${PODS_CONFIGURATION_BUILD_DIR}/SwiftyJSON" "${PODS_CONFIGURATION_BUILD_DIR}/WebViewJavascriptBridge" "${PODS_CONFIGURATION_BUILD_DIR}/Yams" "${PODS_ROOT}/Crashlytics/OSX" "${PODS_ROOT}/Fabric/OSX"
FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire" "${PODS_CONFIGURATION_BUILD_DIR}/CocoaLumberjack" "${PODS_CONFIGURATION_BUILD_DIR}/LetsMove" "${PODS_CONFIGURATION_BUILD_DIR}/RxCocoa" "${PODS_CONFIGURATION_BUILD_DIR}/RxSwift" "${PODS_CONFIGURATION_BUILD_DIR}/SwiftyJSON" "${PODS_CONFIGURATION_BUILD_DIR}/WebViewJavascriptBridge" "${PODS_CONFIGURATION_BUILD_DIR}/Yams" "${PODS_ROOT}/Crashlytics/OSX" "${PODS_ROOT}/Fabric/OSX" "${PODS_ROOT}/Sparkle"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
LD_RUNPATH_SEARCH_PATHS = @loader_path/../Frameworks $(inherited) '@executable_path/../Frameworks' '@loader_path/Frameworks'
OTHER_CFLAGS = $(inherited) -iquote "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire/Alamofire.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/CocoaLumberjack/CocoaLumberjack.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/LetsMove/LetsMove.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/RxAtomic/RxAtomic.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/RxCocoa/RxCocoa.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/RxSwift/RxSwift.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/SwiftyJSON/SwiftyJSON.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/WebViewJavascriptBridge/WebViewJavascriptBridge.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/Yams/Yams.framework/Headers"
OTHER_LDFLAGS = $(inherited) -ObjC -l"c++" -l"z" -framework "Alamofire" -framework "CocoaLumberjack" -framework "Crashlytics" -framework "Fabric" -framework "LetsMove" -framework "RxAtomic" -framework "RxCocoa" -framework "RxSwift" -framework "Security" -framework "Sparkle" -framework "SwiftyJSON" -framework "SystemConfiguration" -framework "WebViewJavascriptBridge" -framework "Yams"
OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire/Alamofire.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/CocoaLumberjack/CocoaLumberjack.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/LetsMove/LetsMove.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/RxCocoa/RxCocoa.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/RxSwift/RxSwift.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/SwiftyJSON/SwiftyJSON.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/WebViewJavascriptBridge/WebViewJavascriptBridge.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/Yams/Yams.framework/Headers"
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/../Frameworks' '@loader_path/Frameworks' @loader_path/../Frameworks
OTHER_LDFLAGS = $(inherited) -ObjC -l"c++" -l"z" -framework "Alamofire" -framework "CocoaLumberjack" -framework "Crashlytics" -framework "Fabric" -framework "LetsMove" -framework "RxCocoa" -framework "RxSwift" -framework "Security" -framework "Sparkle" -framework "SwiftyJSON" -framework "SystemConfiguration" -framework "WebKit" -framework "WebViewJavascriptBridge" -framework "Yams"
OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_PODFILE_DIR_PATH = ${SRCROOT}/.

View File

@ -1,11 +1,11 @@
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES
CODE_SIGN_IDENTITY =
FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Sparkle" "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire" "${PODS_CONFIGURATION_BUILD_DIR}/CocoaLumberjack" "${PODS_CONFIGURATION_BUILD_DIR}/LetsMove" "${PODS_CONFIGURATION_BUILD_DIR}/RxAtomic" "${PODS_CONFIGURATION_BUILD_DIR}/RxCocoa" "${PODS_CONFIGURATION_BUILD_DIR}/RxSwift" "${PODS_CONFIGURATION_BUILD_DIR}/SwiftyJSON" "${PODS_CONFIGURATION_BUILD_DIR}/WebViewJavascriptBridge" "${PODS_CONFIGURATION_BUILD_DIR}/Yams" "${PODS_ROOT}/Crashlytics/OSX" "${PODS_ROOT}/Fabric/OSX"
FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire" "${PODS_CONFIGURATION_BUILD_DIR}/CocoaLumberjack" "${PODS_CONFIGURATION_BUILD_DIR}/LetsMove" "${PODS_CONFIGURATION_BUILD_DIR}/RxCocoa" "${PODS_CONFIGURATION_BUILD_DIR}/RxSwift" "${PODS_CONFIGURATION_BUILD_DIR}/SwiftyJSON" "${PODS_CONFIGURATION_BUILD_DIR}/WebViewJavascriptBridge" "${PODS_CONFIGURATION_BUILD_DIR}/Yams" "${PODS_ROOT}/Crashlytics/OSX" "${PODS_ROOT}/Fabric/OSX" "${PODS_ROOT}/Sparkle"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
LD_RUNPATH_SEARCH_PATHS = @loader_path/../Frameworks $(inherited) '@executable_path/../Frameworks' '@loader_path/Frameworks'
OTHER_CFLAGS = $(inherited) -iquote "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire/Alamofire.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/CocoaLumberjack/CocoaLumberjack.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/LetsMove/LetsMove.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/RxAtomic/RxAtomic.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/RxCocoa/RxCocoa.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/RxSwift/RxSwift.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/SwiftyJSON/SwiftyJSON.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/WebViewJavascriptBridge/WebViewJavascriptBridge.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/Yams/Yams.framework/Headers"
OTHER_LDFLAGS = $(inherited) -ObjC -l"c++" -l"z" -framework "Alamofire" -framework "CocoaLumberjack" -framework "Crashlytics" -framework "Fabric" -framework "LetsMove" -framework "RxAtomic" -framework "RxCocoa" -framework "RxSwift" -framework "Security" -framework "Sparkle" -framework "SwiftyJSON" -framework "SystemConfiguration" -framework "WebViewJavascriptBridge" -framework "Yams"
OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire/Alamofire.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/CocoaLumberjack/CocoaLumberjack.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/LetsMove/LetsMove.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/RxCocoa/RxCocoa.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/RxSwift/RxSwift.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/SwiftyJSON/SwiftyJSON.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/WebViewJavascriptBridge/WebViewJavascriptBridge.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/Yams/Yams.framework/Headers"
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/../Frameworks' '@loader_path/Frameworks' @loader_path/../Frameworks
OTHER_LDFLAGS = $(inherited) -ObjC -l"c++" -l"z" -framework "Alamofire" -framework "CocoaLumberjack" -framework "Crashlytics" -framework "Fabric" -framework "LetsMove" -framework "RxCocoa" -framework "RxSwift" -framework "Security" -framework "Sparkle" -framework "SwiftyJSON" -framework "SystemConfiguration" -framework "WebKit" -framework "WebViewJavascriptBridge" -framework "Yams"
OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_PODFILE_DIR_PATH = ${SRCROOT}/.

View File

@ -1,5 +0,0 @@
#import <Foundation/Foundation.h>
@interface PodsDummy_RxAtomic : NSObject
@end
@implementation PodsDummy_RxAtomic
@end

View File

@ -1,12 +0,0 @@
#ifdef __OBJC__
#import <Cocoa/Cocoa.h>
#else
#ifndef FOUNDATION_EXPORT
#if defined(__cplusplus)
#define FOUNDATION_EXPORT extern "C"
#else
#define FOUNDATION_EXPORT extern
#endif
#endif
#endif

View File

@ -1,17 +0,0 @@
#ifdef __OBJC__
#import <Cocoa/Cocoa.h>
#else
#ifndef FOUNDATION_EXPORT
#if defined(__cplusplus)
#define FOUNDATION_EXPORT extern "C"
#else
#define FOUNDATION_EXPORT extern
#endif
#endif
#endif
#import "RxAtomic.h"
FOUNDATION_EXPORT double RxAtomicVersionNumber;
FOUNDATION_EXPORT const unsigned char RxAtomicVersionString[];

View File

@ -1,6 +0,0 @@
framework module RxAtomic {
umbrella header "RxAtomic-umbrella.h"
export *
module * { export * }
}

View File

@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>4.4.2</string>
<string>4.5.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>${PRODUCT_BUNDLE_IDENTIFIER}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>4.5.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>${CURRENT_PROJECT_VERSION}</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>

View File

@ -1,8 +1,8 @@
CODE_SIGN_IDENTITY =
CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/RxCocoa
FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/RxAtomic" "${PODS_CONFIGURATION_BUILD_DIR}/RxSwift"
FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/RxSwift"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_ROOT = ${SRCROOT}

View File

@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>4.4.2</string>
<string>4.5.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>${PRODUCT_BUNDLE_IDENTIFIER}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>4.5.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>${CURRENT_PROJECT_VERSION}</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>

View File

@ -1,8 +1,7 @@
CODE_SIGN_IDENTITY =
CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/RxSwift
FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/RxAtomic"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_ROOT = ${SRCROOT}

11
Pods/Target Support Files/Sparkle/Sparkle.xcconfig generated vendored Normal file
View File

@ -0,0 +1,11 @@
CODE_SIGN_IDENTITY =
CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Sparkle
FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Sparkle"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
LD_RUNPATH_SEARCH_PATHS = @loader_path/../Frameworks
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_ROOT = ${SRCROOT}
PODS_TARGET_SRCROOT = ${PODS_ROOT}/Sparkle
PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
SKIP_INSTALL = YES

View File

@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>4.2.0</string>
<string>4.3.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>${PRODUCT_BUNDLE_IDENTIFIER}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>4.3.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>${CURRENT_PROJECT_VERSION}</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>

View File

@ -1,7 +1,7 @@
CODE_SIGN_IDENTITY =
CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/SwiftyJSON
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_ROOT = ${SRCROOT}

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>${PRODUCT_BUNDLE_IDENTIFIER}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>6.0.3</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>${CURRENT_PROJECT_VERSION}</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>

View File

@ -1,7 +1,7 @@
CODE_SIGN_IDENTITY =
CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/WebViewJavascriptBridge
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
OTHER_LDFLAGS = -framework "WebKit"
OTHER_LDFLAGS = $(inherited) -framework "WebKit"
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_ROOT = ${SRCROOT}

View File

@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0.1</string>
<string>2.0.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>${PRODUCT_BUNDLE_IDENTIFIER}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>2.0.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>${CURRENT_PROJECT_VERSION}</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>

View File

@ -2,7 +2,7 @@ APPLICATION_EXTENSION_API_ONLY = YES
CODE_SIGN_IDENTITY =
CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Yams
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_ROOT = ${SRCROOT}

12
Pods/Yams/README.md generated
View File

@ -5,19 +5,19 @@
A sweet and swifty [YAML](http://yaml.org/) parser built on
[LibYAML](https://github.com/yaml/libyaml).
[![CircleCI](https://circleci.com/gh/jpsim/Yams.svg?style=svg)](https://circleci.com/gh/jpsim/Yams)
[![Azure Pipelines](https://dev.azure.com/jpsim/Yams/_apis/build/status/jpsim.Yams)](https://dev.azure.com/jpsim/Yams/_build/latest?definitionId=1)
## Installation
Building Yams on macOS requires Xcode 9.x or a Swift 3.2/4.x toolchain with
the Swift Package Manager.
Building Yams on macOS requires Xcode 9.x/10.x or a Swift 3.2/4.x/5.x toolchain
with the Swift Package Manager.
Building Yams on Linux requires a Swift 4.x compiler and Swift Package Manager
to be installed.
Building Yams on Linux requires a Swift 4.x/5.x compiler and Swift Package
Manager to be installed.
### Swift Package Manager
Add `.package(url: "https://github.com/jpsim/Yams.git", from: "1.0.1")` to your
Add `.package(url: "https://github.com/jpsim/Yams.git", from: "2.0.0")` to your
`Package.swift` file's `dependencies`.
### CocoaPods

View File

@ -52,7 +52,7 @@ YAML_DECLARE(int)
yaml_string_extend(yaml_char_t **start,
yaml_char_t **pointer, yaml_char_t **end)
{
yaml_char_t *new_start = yaml_realloc(*start, (*end - *start)*2);
yaml_char_t *new_start = (yaml_char_t *)yaml_realloc((void*)*start, (*end - *start)*2);
if (!new_start) return 0;
@ -72,8 +72,9 @@ yaml_string_extend(yaml_char_t **start,
YAML_DECLARE(int)
yaml_string_join(
yaml_char_t **a_start, yaml_char_t **a_pointer, yaml_char_t **a_end,
yaml_char_t **b_start, yaml_char_t **b_pointer, yaml_char_t **b_end)
yaml_char_t **b_start, yaml_char_t **b_pointer, SHIM(yaml_char_t **b_end))
{
UNUSED_PARAM(b_end)
if (*b_start == *b_pointer)
return 1;
@ -95,7 +96,12 @@ yaml_string_join(
YAML_DECLARE(int)
yaml_stack_extend(void **start, void **top, void **end)
{
void *new_start = yaml_realloc(*start, ((char *)*end - (char *)*start)*2);
void *new_start;
if ((char *)*end - (char *)*start >= INT_MAX / 2)
return 0;
new_start = yaml_realloc(*start, ((char *)*end - (char *)*start)*2);
if (!new_start) return 0;
@ -155,17 +161,17 @@ yaml_parser_initialize(yaml_parser_t *parser)
goto error;
if (!BUFFER_INIT(parser, parser->buffer, INPUT_BUFFER_SIZE))
goto error;
if (!QUEUE_INIT(parser, parser->tokens, INITIAL_QUEUE_SIZE))
if (!QUEUE_INIT(parser, parser->tokens, INITIAL_QUEUE_SIZE, yaml_token_t*))
goto error;
if (!STACK_INIT(parser, parser->indents, INITIAL_STACK_SIZE))
if (!STACK_INIT(parser, parser->indents, int*))
goto error;
if (!STACK_INIT(parser, parser->simple_keys, INITIAL_STACK_SIZE))
if (!STACK_INIT(parser, parser->simple_keys, yaml_simple_key_t*))
goto error;
if (!STACK_INIT(parser, parser->states, INITIAL_STACK_SIZE))
if (!STACK_INIT(parser, parser->states, yaml_parser_state_t*))
goto error;
if (!STACK_INIT(parser, parser->marks, INITIAL_STACK_SIZE))
if (!STACK_INIT(parser, parser->marks, yaml_mark_t*))
goto error;
if (!STACK_INIT(parser, parser->tag_directives, INITIAL_STACK_SIZE))
if (!STACK_INIT(parser, parser->tag_directives, yaml_tag_directive_t*))
goto error;
return 1;
@ -221,7 +227,7 @@ static int
yaml_string_read_handler(void *data, unsigned char *buffer, size_t size,
size_t *size_read)
{
yaml_parser_t *parser = data;
yaml_parser_t *parser = (yaml_parser_t *)data;
if (parser->input.string.current == parser->input.string.end) {
*size_read = 0;
@ -247,7 +253,7 @@ static int
yaml_file_read_handler(void *data, unsigned char *buffer, size_t size,
size_t *size_read)
{
yaml_parser_t *parser = data;
yaml_parser_t *parser = (yaml_parser_t *)data;
*size_read = fread(buffer, 1, size, parser->input.file);
return !ferror(parser->input.file);
@ -333,13 +339,13 @@ yaml_emitter_initialize(yaml_emitter_t *emitter)
goto error;
if (!BUFFER_INIT(emitter, emitter->raw_buffer, OUTPUT_RAW_BUFFER_SIZE))
goto error;
if (!STACK_INIT(emitter, emitter->states, INITIAL_STACK_SIZE))
if (!STACK_INIT(emitter, emitter->states, yaml_emitter_state_t*))
goto error;
if (!QUEUE_INIT(emitter, emitter->events, INITIAL_QUEUE_SIZE))
if (!QUEUE_INIT(emitter, emitter->events, INITIAL_QUEUE_SIZE, yaml_event_t*))
goto error;
if (!STACK_INIT(emitter, emitter->indents, INITIAL_STACK_SIZE))
if (!STACK_INIT(emitter, emitter->indents, int*))
goto error;
if (!STACK_INIT(emitter, emitter->tag_directives, INITIAL_STACK_SIZE))
if (!STACK_INIT(emitter, emitter->tag_directives, yaml_tag_directive_t*))
goto error;
return 1;
@ -391,7 +397,7 @@ yaml_emitter_delete(yaml_emitter_t *emitter)
static int
yaml_string_write_handler(void *data, unsigned char *buffer, size_t size)
{
yaml_emitter_t *emitter = data;
yaml_emitter_t *emitter = (yaml_emitter_t *)data;
if (emitter->output.string.size - *emitter->output.string.size_written
< size) {
@ -417,7 +423,7 @@ yaml_string_write_handler(void *data, unsigned char *buffer, size_t size)
static int
yaml_file_write_handler(void *data, unsigned char *buffer, size_t size)
{
yaml_emitter_t *emitter = data;
yaml_emitter_t *emitter = (yaml_emitter_t *)data;
return (fwrite(buffer, 1, size, emitter->output.file) == size);
}
@ -695,7 +701,7 @@ yaml_document_start_event_initialize(yaml_event_t *event,
/* Valid tag directives are expected. */
if (version_directive) {
version_directive_copy = yaml_malloc(sizeof(yaml_version_directive_t));
version_directive_copy = YAML_MALLOC_STATIC(yaml_version_directive_t);
if (!version_directive_copy) goto error;
version_directive_copy->major = version_directive->major;
version_directive_copy->minor = version_directive->minor;
@ -703,7 +709,7 @@ yaml_document_start_event_initialize(yaml_event_t *event,
if (tag_directives_start != tag_directives_end) {
yaml_tag_directive_t *tag_directive;
if (!STACK_INIT(&context, tag_directives_copy, INITIAL_STACK_SIZE))
if (!STACK_INIT(&context, tag_directives_copy, yaml_tag_directive_t*))
goto error;
for (tag_directive = tag_directives_start;
tag_directive != tag_directives_end; tag_directive ++) {
@ -824,7 +830,7 @@ yaml_scalar_event_initialize(yaml_event_t *event,
}
if (!yaml_check_utf8(value, length)) goto error;
value_copy = yaml_malloc(length+1);
value_copy = YAML_MALLOC(length+1);
if (!value_copy) goto error;
memcpy(value_copy, value, length);
value_copy[length] = '\0';
@ -1036,10 +1042,10 @@ yaml_document_initialize(yaml_document_t *document,
(tag_directives_start == tag_directives_end));
/* Valid tag directives are expected. */
if (!STACK_INIT(&context, nodes, INITIAL_STACK_SIZE)) goto error;
if (!STACK_INIT(&context, nodes, yaml_node_t*)) goto error;
if (version_directive) {
version_directive_copy = yaml_malloc(sizeof(yaml_version_directive_t));
version_directive_copy = YAML_MALLOC_STATIC(yaml_version_directive_t);
if (!version_directive_copy) goto error;
version_directive_copy->major = version_directive->major;
version_directive_copy->minor = version_directive->minor;
@ -1047,7 +1053,7 @@ yaml_document_initialize(yaml_document_t *document,
if (tag_directives_start != tag_directives_end) {
yaml_tag_directive_t *tag_directive;
if (!STACK_INIT(&context, tag_directives_copy, INITIAL_STACK_SIZE))
if (!STACK_INIT(&context, tag_directives_copy, yaml_tag_directive_t*))
goto error;
for (tag_directive = tag_directives_start;
tag_directive != tag_directives_end; tag_directive ++) {
@ -1097,13 +1103,8 @@ error:
YAML_DECLARE(void)
yaml_document_delete(yaml_document_t *document)
{
struct {
yaml_error_type_t error;
} context;
yaml_tag_directive_t *tag_directive;
context.error = YAML_NO_ERROR; /* Eliminate a compliler warning. */
assert(document); /* Non-NULL document object is expected. */
while (!STACK_EMPTY(&context, document->nodes)) {
@ -1203,7 +1204,7 @@ yaml_document_add_scalar(yaml_document_t *document,
}
if (!yaml_check_utf8(value, length)) goto error;
value_copy = yaml_malloc(length+1);
value_copy = YAML_MALLOC(length+1);
if (!value_copy) goto error;
memcpy(value_copy, value, length);
value_copy[length] = '\0';
@ -1253,7 +1254,7 @@ yaml_document_add_sequence(yaml_document_t *document,
tag_copy = yaml_strdup(tag);
if (!tag_copy) goto error;
if (!STACK_INIT(&context, items, INITIAL_STACK_SIZE)) goto error;
if (!STACK_INIT(&context, items, yaml_node_item_t*)) goto error;
SEQUENCE_NODE_INIT(node, tag_copy, items.start, items.end,
style, mark, mark);
@ -1301,7 +1302,7 @@ yaml_document_add_mapping(yaml_document_t *document,
tag_copy = yaml_strdup(tag);
if (!tag_copy) goto error;
if (!STACK_INIT(&context, pairs, INITIAL_STACK_SIZE)) goto error;
if (!STACK_INIT(&context, pairs, yaml_node_pair_t*)) goto error;
MAPPING_NODE_INIT(node, tag_copy, pairs.start, pairs.end,
style, mark, mark);

View File

@ -16,7 +16,7 @@
#define PUT(emitter,value) \
(FLUSH(emitter) \
&& (*(emitter->buffer.pointer++) = (yaml_char_t)(value), \
emitter->column ++, \
emitter->column++, \
1))
/*
@ -221,7 +221,7 @@ yaml_emitter_write_indent(yaml_emitter_t *emitter);
static int
yaml_emitter_write_indicator(yaml_emitter_t *emitter,
char *indicator, int need_whitespace,
const char *indicator, int need_whitespace,
int is_whitespace, int is_indention);
static int
@ -649,13 +649,6 @@ yaml_emitter_emit_document_start(yaml_emitter_t *emitter,
else if (event->type == YAML_STREAM_END_EVENT)
{
if (emitter->open_ended)
{
if (!yaml_emitter_write_indicator(emitter, "...", 1, 0, 0))
return 0;
if (!yaml_emitter_write_indent(emitter))
return 0;
}
if (!yaml_emitter_flush(emitter))
return 0;
@ -1002,7 +995,7 @@ yaml_emitter_emit_node(yaml_emitter_t *emitter, yaml_event_t *event,
*/
static int
yaml_emitter_emit_alias(yaml_emitter_t *emitter, yaml_event_t *event)
yaml_emitter_emit_alias(yaml_emitter_t *emitter, SHIM(yaml_event_t *event))
{
if (!yaml_emitter_process_anchor(emitter))
return 0;
@ -1087,7 +1080,7 @@ yaml_emitter_emit_mapping_start(yaml_emitter_t *emitter, yaml_event_t *event)
*/
static int
yaml_emitter_check_empty_document(yaml_emitter_t *emitter)
yaml_emitter_check_empty_document(SHIM(yaml_emitter_t *emitter))
{
return 0;
}
@ -1784,7 +1777,7 @@ yaml_emitter_write_indent(yaml_emitter_t *emitter)
static int
yaml_emitter_write_indicator(yaml_emitter_t *emitter,
char *indicator, int need_whitespace,
const char *indicator, int need_whitespace,
int is_whitespace, int is_indention)
{
size_t indicator_length;
@ -1946,6 +1939,10 @@ yaml_emitter_write_plain_scalar(yaml_emitter_t *emitter,
emitter->whitespace = 0;
emitter->indention = 0;
if (emitter->root_context)
{
emitter->open_ended = 1;
}
return 1;
}
@ -2004,6 +2001,9 @@ yaml_emitter_write_single_quoted_scalar(yaml_emitter_t *emitter,
}
}
if (breaks)
if (!yaml_emitter_write_indent(emitter)) return 0;
if (!yaml_emitter_write_indicator(emitter, "'", 0, 0, 0))
return 0;
@ -2174,7 +2174,7 @@ yaml_emitter_write_block_scalar_hints(yaml_emitter_t *emitter,
yaml_string_t string)
{
char indent_hint[2];
char *chomp_hint = NULL;
const char *chomp_hint = NULL;
if (IS_SPACE(string) || IS_BREAK(string))
{

View File

@ -605,7 +605,7 @@ yaml_parser_parse_node(yaml_parser_t *parser, yaml_event_t *event,
if (strcmp((char *)tag_directive->handle, (char *)tag_handle) == 0) {
size_t prefix_len = strlen((char *)tag_directive->prefix);
size_t suffix_len = strlen((char *)tag_suffix);
tag = yaml_malloc(prefix_len+suffix_len+1);
tag = YAML_MALLOC(prefix_len+suffix_len+1);
if (!tag) {
parser->error = YAML_MEMORY_ERROR;
goto error;
@ -685,7 +685,7 @@ yaml_parser_parse_node(yaml_parser_t *parser, yaml_event_t *event,
return 1;
}
else if (anchor || tag) {
yaml_char_t *value = yaml_malloc(1);
yaml_char_t *value = YAML_MALLOC(1);
if (!value) {
parser->error = YAML_MEMORY_ERROR;
goto error;
@ -730,7 +730,7 @@ yaml_parser_parse_block_sequence_entry(yaml_parser_t *parser,
if (first) {
token = PEEK_TOKEN(parser);
if (!token || !PUSH(parser, parser->marks, token->start_mark))
if (!PUSH(parser, parser->marks, token->start_mark))
return 0;
SKIP_TOKEN(parser);
}
@ -760,7 +760,7 @@ yaml_parser_parse_block_sequence_entry(yaml_parser_t *parser,
else if (token->type == YAML_BLOCK_END_TOKEN)
{
parser->state = POP(parser, parser->states);
POP(parser, parser->marks);
(void)POP(parser, parser->marks);
SEQUENCE_END_EVENT_INIT(*event, token->start_mark, token->end_mark);
SKIP_TOKEN(parser);
return 1;
@ -838,7 +838,7 @@ yaml_parser_parse_block_mapping_key(yaml_parser_t *parser,
if (first) {
token = PEEK_TOKEN(parser);
if (!token || !PUSH(parser, parser->marks, token->start_mark))
if (!PUSH(parser, parser->marks, token->start_mark))
return 0;
SKIP_TOKEN(parser);
}
@ -869,7 +869,7 @@ yaml_parser_parse_block_mapping_key(yaml_parser_t *parser,
else if (token->type == YAML_BLOCK_END_TOKEN)
{
parser->state = POP(parser, parser->states);
POP(parser, parser->marks);
(void)POP(parser, parser->marks);
MAPPING_END_EVENT_INIT(*event, token->start_mark, token->end_mark);
SKIP_TOKEN(parser);
return 1;
@ -953,7 +953,7 @@ yaml_parser_parse_flow_sequence_entry(yaml_parser_t *parser,
if (first) {
token = PEEK_TOKEN(parser);
if (!token || !PUSH(parser, parser->marks, token->start_mark))
if (!PUSH(parser, parser->marks, token->start_mark))
return 0;
SKIP_TOKEN(parser);
}
@ -994,7 +994,7 @@ yaml_parser_parse_flow_sequence_entry(yaml_parser_t *parser,
}
parser->state = POP(parser, parser->states);
POP(parser, parser->marks);
(void)POP(parser, parser->marks);
SEQUENCE_END_EVENT_INIT(*event, token->start_mark, token->end_mark);
SKIP_TOKEN(parser);
return 1;
@ -1104,7 +1104,7 @@ yaml_parser_parse_flow_mapping_key(yaml_parser_t *parser,
if (first) {
token = PEEK_TOKEN(parser);
if (!token || !PUSH(parser, parser->marks, token->start_mark))
if (!PUSH(parser, parser->marks, token->start_mark))
return 0;
SKIP_TOKEN(parser);
}
@ -1154,7 +1154,7 @@ yaml_parser_parse_flow_mapping_key(yaml_parser_t *parser,
}
parser->state = POP(parser, parser->states);
POP(parser, parser->marks);
(void)POP(parser, parser->marks);
MAPPING_END_EVENT_INIT(*event, token->start_mark, token->end_mark);
SKIP_TOKEN(parser);
return 1;
@ -1208,7 +1208,7 @@ yaml_parser_process_empty_scalar(yaml_parser_t *parser, yaml_event_t *event,
{
yaml_char_t *value;
value = yaml_malloc(1);
value = YAML_MALLOC(1);
if (!value) {
parser->error = YAML_MEMORY_ERROR;
return 0;
@ -1245,7 +1245,7 @@ yaml_parser_process_directives(yaml_parser_t *parser,
} tag_directives = { NULL, NULL, NULL };
yaml_token_t *token;
if (!STACK_INIT(parser, tag_directives, INITIAL_STACK_SIZE))
if (!STACK_INIT(parser, tag_directives, yaml_tag_directive_t*))
goto error;
token = PEEK_TOKEN(parser);
@ -1266,7 +1266,7 @@ yaml_parser_process_directives(yaml_parser_t *parser,
"found incompatible YAML document", token->start_mark);
goto error;
}
version_directive = yaml_malloc(sizeof(yaml_version_directive_t));
version_directive = YAML_MALLOC_STATIC(yaml_version_directive_t);
if (!version_directive) {
parser->error = YAML_MEMORY_ERROR;
goto error;
@ -1316,6 +1316,8 @@ yaml_parser_process_directives(yaml_parser_t *parser,
STACK_DEL(parser, tag_directives);
}
if (!version_directive_ref)
yaml_free(version_directive);
return 1;
error:

View File

@ -460,10 +460,10 @@ yaml_parser_update_buffer(yaml_parser_t *parser, size_t length)
}
if (parser->offset >= PTRDIFF_MAX)
if (parser->offset >= MAX_FILE_SIZE) {
return yaml_parser_set_reader_error(parser, "input is too long",
PTRDIFF_MAX, -1);
parser->offset, -1);
}
return 1;
}

View File

@ -38,8 +38,8 @@
* BLOCK-END # Indentation decrease.
* FLOW-SEQUENCE-START # '['
* FLOW-SEQUENCE-END # ']'
* BLOCK-SEQUENCE-START # '{'
* BLOCK-SEQUENCE-END # '}'
* FLOW-MAPPING-START # '{'
* FLOW-MAPPING-END # '}'
* BLOCK-ENTRY # '-'
* FLOW-ENTRY # ','
* KEY # '?' or nothing (simple keys).
@ -1188,7 +1188,7 @@ yaml_parser_decrease_flow_level(yaml_parser_t *parser)
{
if (parser->flow_level) {
parser->flow_level --;
POP(parser, parser->simple_keys);
(void)POP(parser, parser->simple_keys);
}
return 1;
@ -1639,7 +1639,7 @@ yaml_parser_fetch_key(yaml_parser_t *parser)
if (!parser->flow_level)
{
/* Check if we are allowed to start a new key (not nessesary simple). */
/* Check if we are allowed to start a new key (not necessary simple). */
if (!parser->simple_key_allowed) {
return yaml_parser_set_scanner_error(parser, NULL, parser->mark,
@ -2402,7 +2402,7 @@ yaml_parser_scan_tag(yaml_parser_t *parser, yaml_token_t *token)
{
/* Set the handle to '' */
handle = yaml_malloc(1);
handle = YAML_MALLOC(1);
if (!handle) goto error;
handle[0] = '\0';
@ -2454,7 +2454,7 @@ yaml_parser_scan_tag(yaml_parser_t *parser, yaml_token_t *token)
/* Set the handle to '!'. */
yaml_free(handle);
handle = yaml_malloc(2);
handle = YAML_MALLOC(2);
if (!handle) goto error;
handle[0] = '!';
handle[1] = '\0';
@ -2863,7 +2863,7 @@ yaml_parser_scan_block_scalar(yaml_parser_t *parser, yaml_token_t *token,
if (!CACHE(parser, 1)) goto error;
while ((int)parser->mark.column == indent && !IS_Z(parser->buffer))
while ((int)parser->mark.column == indent && !(IS_Z(parser->buffer)))
{
/*
* We are at the beginning of a non-empty line.
@ -3167,10 +3167,6 @@ yaml_parser_scan_flow_scalar(yaml_parser_t *parser, yaml_token_t *token,
*(string.pointer++) = '/';
break;
case '\'':
*(string.pointer++) = '\'';
break;
case '\\':
*(string.pointer++) = '\\';
break;
@ -3437,11 +3433,22 @@ yaml_parser_scan_plain_scalar(yaml_parser_t *parser, yaml_token_t *token)
while (!IS_BLANKZ(parser->buffer))
{
/* Check for 'x:x' in the flow context. TODO: Fix the test "spec-08-13". */
/* Check for "x:" + one of ',?[]{}' in the flow context. TODO: Fix the test "spec-08-13".
* This is not completely according to the spec
* See http://yaml.org/spec/1.1/#id907281 9.1.3. Plain
*/
if (parser->flow_level
&& CHECK(parser->buffer, ':')
&& !IS_BLANKZ_AT(parser->buffer, 1)) {
&& (
CHECK_AT(parser->buffer, ',', 1)
|| CHECK_AT(parser->buffer, '?', 1)
|| CHECK_AT(parser->buffer, '[', 1)
|| CHECK_AT(parser->buffer, ']', 1)
|| CHECK_AT(parser->buffer, '{', 1)
|| CHECK_AT(parser->buffer, '}', 1)
)
) {
yaml_parser_set_scanner_error(parser, "while scanning a plain scalar",
start_mark, "found unexpected ':'");
goto error;
@ -3451,7 +3458,7 @@ yaml_parser_scan_plain_scalar(yaml_parser_t *parser, yaml_token_t *token)
if ((CHECK(parser->buffer, ':') && IS_BLANKZ_AT(parser->buffer, 1))
|| (parser->flow_level &&
(CHECK(parser->buffer, ',') || CHECK(parser->buffer, ':')
(CHECK(parser->buffer, ',')
|| CHECK(parser->buffer, '?') || CHECK(parser->buffer, '[')
|| CHECK(parser->buffer, ']') || CHECK(parser->buffer, '{')
|| CHECK(parser->buffer, '}'))))

View File

@ -1,23 +1,9 @@
#if HAVE_CONFIG_H
#include <config.h>
#endif
#include "yaml.h"
#include <assert.h>
#include <limits.h>
#include <stddef.h>
#ifndef _MSC_VER
#include <stdint.h>
#else
#ifdef _WIN64
#define PTRDIFF_MAX _I64_MAX
#else
#define PTRDIFF_MAX INT_MAX
#endif
#endif
/*
* Memory management.
*/
@ -76,6 +62,17 @@ yaml_parser_fetch_more_tokens(yaml_parser_t *parser);
#define OUTPUT_RAW_BUFFER_SIZE (OUTPUT_BUFFER_SIZE*2+2)
/*
* The maximum size of a YAML input file.
* This used to be PTRDIFF_MAX, but that's not entirely portable
* because stdint.h isn't available on all platforms.
* It is not entirely clear why this isn't the maximum value
* that can fit into the parser->offset field.
*/
#define MAX_FILE_SIZE (~(size_t)0 / 2)
/*
* The size of other stacks and queues.
*/
@ -89,7 +86,7 @@ yaml_parser_fetch_more_tokens(yaml_parser_t *parser);
*/
#define BUFFER_INIT(context,buffer,size) \
(((buffer).start = yaml_malloc(size)) ? \
(((buffer).start = (yaml_char_t *)yaml_malloc(size)) ? \
((buffer).last = (buffer).pointer = (buffer).start, \
(buffer).end = (buffer).start+(size), \
1) : \
@ -129,7 +126,7 @@ yaml_string_join(
(value).pointer = (string))
#define STRING_INIT(context,string,size) \
(((string).start = yaml_malloc(size)) ? \
(((string).start = YAML_MALLOC(size)) ? \
((string).pointer = (string).start, \
(string).end = (string).start+(size), \
memset((string).start, 0, (size)), \
@ -170,14 +167,14 @@ yaml_string_join(
* Check the octet at the specified position.
*/
#define CHECK_AT(string,octet,offset) \
#define CHECK_AT(string,octet,offset) \
((string).pointer[offset] == (yaml_char_t)(octet))
/*
* Check the current octet in the buffer.
*/
#define CHECK(string,octet) CHECK_AT((string),(octet),0)
#define CHECK(string,octet) (CHECK_AT((string),(octet),0))
/*
* Check if the character at the specified position is an alphabetical
@ -419,10 +416,10 @@ yaml_stack_extend(void **start, void **top, void **end);
YAML_DECLARE(int)
yaml_queue_extend(void **start, void **head, void **tail, void **end);
#define STACK_INIT(context,stack,size) \
(((stack).start = yaml_malloc((size)*sizeof(*(stack).start))) ? \
#define STACK_INIT(context,stack,type) \
(((stack).start = (type)yaml_malloc(INITIAL_STACK_SIZE*sizeof(*(stack).start))) ? \
((stack).top = (stack).start, \
(stack).end = (stack).start+(size), \
(stack).end = (stack).start+INITIAL_STACK_SIZE, \
1) : \
((context)->error = YAML_MEMORY_ERROR, \
0))
@ -452,8 +449,8 @@ yaml_queue_extend(void **start, void **head, void **tail, void **end);
#define POP(context,stack) \
(*(--(stack).top))
#define QUEUE_INIT(context,queue,size) \
(((queue).start = yaml_malloc((size)*sizeof(*(queue).start))) ? \
#define QUEUE_INIT(context,queue,size,type) \
(((queue).start = (type)yaml_malloc((size)*sizeof(*(queue).start))) ? \
((queue).head = (queue).tail = (queue).start, \
(queue).end = (queue).start+(size), \
1) : \
@ -656,3 +653,28 @@ yaml_queue_extend(void **start, void **head, void **tail, void **end);
(node).data.mapping.pairs.end = (node_pairs_end), \
(node).data.mapping.pairs.top = (node_pairs_start), \
(node).data.mapping.style = (node_style))
/* Strict C compiler warning helpers */
#if defined(__clang__) || defined(__GNUC__)
# define HASATTRIBUTE_UNUSED
#endif
#ifdef HASATTRIBUTE_UNUSED
# define __attribute__unused__ __attribute__((__unused__))
#else
# define __attribute__unused__
#endif
/* Shim arguments are arguments that must be included in your function,
* but serve no purpose inside. Silence compiler warnings. */
#define SHIM(a) /*@unused@*/ a __attribute__unused__
/* UNUSED_PARAM() marks a shim argument in the body to silence compiler warnings */
#ifdef __clang__
# define UNUSED_PARAM(a) (void)(a);
#else
# define UNUSED_PARAM(a) /*@-noeffect*/if (0) (void)(a)/*@=noeffect*/;
#endif
#define YAML_MALLOC_STATIC(type) (type*)yaml_malloc(sizeof(type))
#define YAML_MALLOC(size) (yaml_char_t *)yaml_malloc(size)

View File

@ -76,7 +76,7 @@ extension Constructor {
.bool: Bool.construct,
.float: Double.construct,
.null: NSNull.construct,
.int: Int.construct,
.int: MemoryLayout<Int>.size == 8 ? Int.construct : { Int.construct(from: $0) ?? Int64.construct(from: $0) },
// http://yaml.org/type/index.html
.binary: Data.construct,
.timestamp: Date.construct
@ -310,6 +310,32 @@ extension UInt: ScalarConstructible {
}
}
// MARK: - ScalarConstructible Int64 Conformance
extension Int64: ScalarConstructible {
/// Construct an instance of `Int64`, if possible, from the specified scalar.
///
/// - parameter scalar: The `Node.Scalar` from which to extract a value of type `Int64`, if possible.
///
/// - returns: An instance of `Int64`, if one was successfully extracted from the scalar.
public static func construct(from scalar: Node.Scalar) -> Int64? {
return _construct(from: scalar)
}
}
// MARK: - ScalarConstructible UInt64 Conformance
extension UInt64: ScalarConstructible {
/// Construct an instance of `UInt64`, if possible, from the specified scalar.
///
/// - parameter scalar: The `Node.Scalar` from which to extract a value of type `UInt64`, if possible.
///
/// - returns: An instance of `UInt64`, if one was successfully extracted from the scalar.
public static func construct(from scalar: Node.Scalar) -> UInt64? {
return _construct(from: scalar)
}
}
// MARK: - ScalarConstructible String Conformance
extension String: ScalarConstructible {
@ -561,8 +587,12 @@ extension Double: SexagesimalConvertible {}
extension Float: SexagesimalConvertible {}
// MARK: - SexagesimalConvertible Int Conformance
extension Int: SexagesimalConvertible {}
// MARK: - SexagesimalConvertible Int Conformance
// MARK: - SexagesimalConvertible UInt Conformance
extension UInt: SexagesimalConvertible {}
// MARK: - SexagesimalConvertible Int64 Conformance
extension Int64: SexagesimalConvertible {}
// MARK: - SexagesimalConvertible UInt64 Conformance
extension UInt64: SexagesimalConvertible {}
private extension String {
func sexagesimal<T>() -> T where T: SexagesimalConvertible {

View File

@ -12,7 +12,11 @@ import Foundation
/// user info mapping. Similar to `Foundation.JSONDecoder`.
public class YAMLDecoder {
/// Creates a `YAMLDecoder` instance.
public init() {}
///
/// - parameter encoding: Encoding, `.default` if omitted.
public init(encoding: Parser.Encoding = .default) {
self.encoding = encoding
}
/// Decode a `Decodable` type from a given `String` and optional user info mapping.
///
@ -27,7 +31,7 @@ public class YAMLDecoder {
from yaml: String,
userInfo: [CodingUserInfoKey: Any] = [:]) throws -> T where T: Swift.Decodable {
do {
let node = try Yams.compose(yaml: yaml, .basic) ?? ""
let node = try Parser(yaml: yaml, resolver: .basic, encoding: encoding).singleRoot() ?? ""
let decoder = _Decoder(referencing: node, userInfo: userInfo)
let container = try decoder.singleValueContainer()
return try container.decode(type)
@ -39,6 +43,9 @@ public class YAMLDecoder {
underlyingError: error))
}
}
/// Encoding
public var encoding: Parser.Encoding
}
private struct _Decoder: Decoder {
@ -109,7 +116,7 @@ private struct _KeyedDecodingContainer<Key: CodingKey> : KeyedDecodingContainerP
func contains(_ key: Key) -> Bool { return mapping[key.stringValue] != nil }
func decodeNil(forKey key: Key) throws -> Bool {
return try node(for: key) == Node("null", Tag(.null))
return try decoder(for: key).decodeNil()
}
func decode<T>(_ type: T.Type, forKey key: Key) throws -> T where T: Decodable & ScalarConstructible {
@ -166,12 +173,7 @@ private struct _UnkeyedDecodingContainer: UnkeyedDecodingContainer {
mutating func decodeNil() throws -> Bool {
try throwErrorIfAtEnd(Any?.self)
if currentNode == Node("null", Tag(.null)) {
currentIndex += 1
return true
} else {
return false
}
return try currentDecoder { $0.decodeNil() }
}
mutating func decode<T>(_ type: T.Type) throws -> T where T: Decodable & ScalarConstructible {
@ -267,7 +269,7 @@ extension FixedWidthInteger where Self: SignedInteger {
///
/// - returns: An instance of `Self`, if one was successfully extracted from the scalar.
public static func construct(from scalar: Node.Scalar) -> Self? {
return Int.construct(from: scalar).flatMap(Self.init(exactly:))
return Int64.construct(from: scalar).flatMap(Self.init(exactly:))
}
}
@ -280,7 +282,7 @@ extension FixedWidthInteger where Self: UnsignedInteger {
///
/// - returns: An instance of `Self`, if one was successfully extracted from the scalar.
public static func construct(from scalar: Node.Scalar) -> Self? {
return UInt.construct(from: scalar).flatMap(Self.init(exactly:))
return UInt64.construct(from: scalar).flatMap(Self.init(exactly:))
}
}
@ -290,16 +292,12 @@ extension Int8: ScalarConstructible {}
extension Int16: ScalarConstructible {}
// MARK: - ScalarConstructible Int32 Conformance
extension Int32: ScalarConstructible {}
// MARK: - ScalarConstructible Int64 Conformance
extension Int64: ScalarConstructible {}
// MARK: - ScalarConstructible UInt8 Conformance
extension UInt8: ScalarConstructible {}
// MARK: - ScalarConstructible UInt16 Conformance
extension UInt16: ScalarConstructible {}
// MARK: - ScalarConstructible UInt32 Conformance
extension UInt32: ScalarConstructible {}
// MARK: - ScalarConstructible UInt64 Conformance
extension UInt64: ScalarConstructible {}
// MARK: - ScalarConstructible Decimal Conformance

View File

@ -143,11 +143,7 @@ public func serialize<Nodes>(
try emitter.open()
try nodes.forEach(emitter.serialize)
try emitter.close()
#if USE_UTF8
return String(data: emitter.data, encoding: .utf8)!
#else
return String(data: emitter.data, encoding: .utf16)!
#endif
}
/// Produce a YAML string from a `Node`.
@ -278,11 +274,7 @@ public final class Emitter {
applyOptionsToEmitter()
#if USE_UTF8
yaml_emitter_set_encoding(&emitter, YAML_UTF8_ENCODING)
#else
yaml_emitter_set_encoding(&emitter, isLittleEndian ? YAML_UTF16LE_ENCODING : YAML_UTF16BE_ENCODING)
#endif
}
deinit {
@ -296,12 +288,7 @@ public final class Emitter {
switch state {
case .initialized:
var event = yaml_event_t()
#if USE_UTF8
yaml_stream_start_event_initialize(&event, YAML_UTF8_ENCODING)
#else
let encoding = isLittleEndian ? YAML_UTF16LE_ENCODING : YAML_UTF16BE_ENCODING
yaml_stream_start_event_initialize(&event, encoding)
#endif
try emit(&event)
state = .opened
case .opened:
@ -424,7 +411,7 @@ extension Emitter {
private func serializeScalar(_ scalar: Node.Scalar) throws {
var value = scalar.string.utf8CString, tag = scalar.resolvedTag.name.rawValue.utf8CString
let scalar_style = yaml_scalar_style_t(rawValue: scalar.style.rawValue)
let scalarStyle = yaml_scalar_style_t(rawValue: scalar.style.rawValue)
var event = yaml_event_t()
_ = value.withUnsafeMutableBytes { value in
tag.withUnsafeMutableBytes { tag in
@ -436,7 +423,7 @@ extension Emitter {
Int32(value.count - 1),
1,
1,
scalar_style)
scalarStyle)
}
}
try emit(&event)
@ -445,7 +432,7 @@ extension Emitter {
private func serializeSequence(_ sequence: Node.Sequence) throws {
var tag = sequence.resolvedTag.name.rawValue.utf8CString
let implicit: Int32 = sequence.tag.name == .seq ? 1 : 0
let sequence_style = yaml_sequence_style_t(rawValue: sequence.style.rawValue)
let sequenceStyle = yaml_sequence_style_t(rawValue: sequence.style.rawValue)
var event = yaml_event_t()
_ = tag.withUnsafeMutableBytes { tag in
yaml_sequence_start_event_initialize(
@ -453,7 +440,7 @@ extension Emitter {
nil,
tag.baseAddress?.assumingMemoryBound(to: UInt8.self),
implicit,
sequence_style)
sequenceStyle)
}
try emit(&event)
try sequence.forEach(self.serializeNode)
@ -464,7 +451,7 @@ extension Emitter {
private func serializeMapping(_ mapping: Node.Mapping) throws {
var tag = mapping.resolvedTag.name.rawValue.utf8CString
let implicit: Int32 = mapping.tag.name == .map ? 1 : 0
let mapping_style = yaml_mapping_style_t(rawValue: mapping.style.rawValue)
let mappingStyle = yaml_mapping_style_t(rawValue: mapping.style.rawValue)
var event = yaml_event_t()
_ = tag.withUnsafeMutableBytes { tag in
yaml_mapping_start_event_initialize(
@ -472,7 +459,7 @@ extension Emitter {
nil,
tag.baseAddress?.assumingMemoryBound(to: UInt8.self),
implicit,
mapping_style)
mappingStyle)
}
try emit(&event)
if options.sortKeys {
@ -491,5 +478,4 @@ extension Emitter {
}
}
private let isLittleEndian = 1 == 1.littleEndian
// swiftlint:disable:this file_length

Some files were not shown because too many files have changed in this diff Show More