Skip to content

Update to Swift 5 and support Carthage #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ DerivedData
*.dSYM.zip
*.ipa
*/xcuserdata/*
.swiftpm
.build
53 changes: 53 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// swift-tools-version:5.0
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "SSignalKit",
platforms: [
.macOS(.v10_10), .iOS(.v9), .tvOS(.v9)
],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
name: "SSignalKit",
targets: [ "SSignalKit" ]),
.library(
name: "SwiftSignalKit",
targets: [ "SwiftSignalKit" ])
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "SSignalKit",
path: ".",
sources: [ "SSignalKit" ],
cSettings: [
.headerSearchPath(".")
]),
.target(
name: "SwiftSignalKit",
path: ".",
sources: [ "SwiftSignalKit" ]),
.testTarget(name: "SSignalKitTests",
dependencies: [ "SSignalKit" ],
path: ".",
sources: [ "SSignalKitTests" ],
cSettings: [
.headerSearchPath(".")
]),
.testTarget(name: "SwiftSignalKitTests",
dependencies: [ "SwiftSignalKit" ],
path: ".",
sources: [ "SwiftSignalKitTests" ])
],
swiftLanguageVersions: [.v5],
cLanguageStandard: .gnu11,
cxxLanguageStandard: .gnucxx14
)
20 changes: 20 additions & 0 deletions ReadMe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Signals

An experimental Rx- and RAC-3.0-inspired FRP framework

Support iOS, tvOS, macOS

## Install with [Carthage](https://github.com/Carthage/Carthage)

Edit Cartfile:

```
github "cntrump/Signals" "main"
```

Build xcframeworks:

```bash
carthage update --use-xcframeworks
```

631 changes: 166 additions & 465 deletions SSignalKit.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

77 changes: 77 additions & 0 deletions SSignalKit.xcodeproj/xcshareddata/xcschemes/SSignalKit.xcscheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1310"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D0445DD71A7C2CA500267924"
BuildableName = "SSignalKit.framework"
BlueprintName = "SSignalKit"
ReferencedContainer = "container:SSignalKit.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "DebugHockeyapp"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D0445DE21A7C2CA500267924"
BuildableName = "SSignalKitTests.xctest"
BlueprintName = "SSignalKitTests"
ReferencedContainer = "container:SSignalKit.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "DebugHockeyapp"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "ReleaseHockeyapp"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D0445DD71A7C2CA500267924"
BuildableName = "SSignalKit.framework"
BlueprintName = "SSignalKit"
ReferencedContainer = "container:SSignalKit.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "DebugHockeyapp">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "ReleaseHockeyapp"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1310"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D0085B211B282B9800EAF753"
BuildableName = "SwiftSignalKit.framework"
BlueprintName = "SwiftSignalKit"
ReferencedContainer = "container:SSignalKit.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "DebugHockeyapp"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D0085B2B1B282B9800EAF753"
BuildableName = "SwiftSignalKitTests.xctest"
BlueprintName = "SwiftSignalKitTests"
ReferencedContainer = "container:SSignalKit.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "DebugHockeyapp"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "ReleaseHockeyapp"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D0085B211B282B9800EAF753"
BuildableName = "SwiftSignalKit.framework"
BlueprintName = "SwiftSignalKit"
ReferencedContainer = "container:SSignalKit.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "DebugHockeyapp">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "ReleaseHockeyapp"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
16 changes: 10 additions & 6 deletions SSignalKit/SAtomic.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface SAtomic : NSObject

- (instancetype)initWithValue:(id)value;
- (instancetype)initWithValue:(id)value recursive:(bool)recursive;
- (id)swap:(id)newValue;
- (id)value;
- (id)modify:(id (^)(id))f;
- (id)with:(id (^)(id))f;
- (instancetype)initWithValue:(id _Nullable)value;
- (instancetype)initWithValue:(id _Nullable)value recursive:(BOOL)recursive;
- (id _Nullable)swap:(id _Nullable)newValue;
- (id _Nullable)value;
- (id _Nullable)modify:(id _Nullable (^)(id _Nullable))f;
- (id _Nullable)with:(id _Nullable (^)(id _Nullable))f;

@end

NS_ASSUME_NONNULL_END
4 changes: 2 additions & 2 deletions SSignalKit/SAtomic.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ @interface SAtomic ()
{
pthread_mutex_t _lock;
pthread_mutexattr_t _attr;
bool _isRecursive;
BOOL _isRecursive;
id _value;
}

Expand All @@ -25,7 +25,7 @@ - (instancetype)initWithValue:(id)value
return self;
}

- (instancetype)initWithValue:(id)value recursive:(bool)recursive {
- (instancetype)initWithValue:(id)value recursive:(BOOL)recursive {
self = [super init];
if (self != nil)
{
Expand Down
6 changes: 5 additions & 1 deletion SSignalKit/SBag.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface SBag : NSObject

- (NSInteger)addItem:(id)item;
- (void)enumerateItems:(void (^)(id))block;
- (void)removeItem:(NSInteger)key;
- (bool)isEmpty;
- (BOOL)isEmpty;
- (NSArray *)copyItems;

@end

NS_ASSUME_NONNULL_END
2 changes: 1 addition & 1 deletion SSignalKit/SBag.m
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ - (void)removeItem:(NSInteger)key
}
}

- (bool)isEmpty
- (BOOL)isEmpty
{
return _items.count == 0;
}
Expand Down
6 changes: 5 additions & 1 deletion SSignalKit/SBlockDisposable.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
#import <SSignalKit/SDisposable.h>

NS_ASSUME_NONNULL_BEGIN

@interface SBlockDisposable : NSObject <SDisposable>

- (instancetype)initWithBlock:(void (^)())block;
- (instancetype)initWithBlock:(void (^ _Nullable)(void))block;

@end

NS_ASSUME_NONNULL_END
2 changes: 1 addition & 1 deletion SSignalKit/SBlockDisposable.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ @interface SBlockDisposable ()

@implementation SBlockDisposable

- (instancetype)initWithBlock:(void (^)())block
- (instancetype)initWithBlock:(void (^)(void))block
{
self = [super init];
if (self != nil)
Expand Down
4 changes: 4 additions & 0 deletions SSignalKit/SDisposable.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@protocol SDisposable <NSObject>

- (void)dispose;

@end

NS_ASSUME_NONNULL_END
4 changes: 4 additions & 0 deletions SSignalKit/SDisposableSet.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#import <SSignalKit/SDisposable.h>

NS_ASSUME_NONNULL_BEGIN

@class SSignal;

@interface SDisposableSet : NSObject <SDisposable>
Expand All @@ -8,3 +10,5 @@
- (void)remove:(id<SDisposable>)disposable;

@end

NS_ASSUME_NONNULL_END
6 changes: 3 additions & 3 deletions SSignalKit/SDisposableSet.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
@interface SDisposableSet ()
{
OSSpinLock _lock;
bool _disposed;
BOOL _disposed;
id<SDisposable> _singleDisposable;
NSArray *_multipleDisposables;
}
Expand All @@ -21,7 +21,7 @@ - (void)add:(id<SDisposable>)disposable
if (disposable == nil)
return;

bool dispose = false;
BOOL dispose = NO;

OSSpinLockLock(&_lock);
dispose = _disposed;
Expand Down Expand Up @@ -73,7 +73,7 @@ - (void)dispose
OSSpinLockLock(&_lock);
if (!_disposed)
{
_disposed = true;
_disposed = YES;
singleDisposable = _singleDisposable;
multipleDisposables = _multipleDisposables;
_singleDisposable = nil;
Expand Down
6 changes: 5 additions & 1 deletion SSignalKit/SMetaDisposable.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
#import <SSignalKit/SDisposable.h>

NS_ASSUME_NONNULL_BEGIN

@interface SMetaDisposable : NSObject <SDisposable>

- (void)setDisposable:(id<SDisposable>)disposable;
- (void)setDisposable:(id<SDisposable> _Nullable)disposable;

@end

NS_ASSUME_NONNULL_END
Loading