Skip to content

Commit

Permalink
Merge pull request #15 from cats-oss/multi-platform
Browse files Browse the repository at this point in the history
Support tvOS, watchOS and macOS
  • Loading branch information
marty-suzuki authored Oct 25, 2019
2 parents 316531e + 4edcb98 commit a92b299
Show file tree
Hide file tree
Showing 8 changed files with 74 additions and 43 deletions.
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import PackageDescription

let package = Package(
name: "Unio",
platforms: [.iOS(.v9)],
platforms: [.macOS(.v10_10), .iOS(.v9), .tvOS(.v10), .watchOS(.v3)],
products: [
.library(name: "Unio",
targets: ["Unio"]),
Expand Down
30 changes: 23 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,26 @@
<strong>Un</strong>idirectional <strong>I</strong>nput <strong>O</strong>utput framework
</p>
<p align='center'>
<a href='https://github.com/Carthage/Carthage'>
<img src='https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat' alt='Carthage compatible' />
</a>
<a href='https://travis-ci.org/cats-oss/Unio'>
<img src='https://travis-ci.org/cats-oss/Unio.svg?branch=master' alt='Build Status' />
</a>
<a href='https://cocoapods.org/pods/Unio'>
<img src='https://img.shields.io/cocoapods/v/Unio.svg?style=flat' alt='Version' />
</a>

<a href='https://cocoapods.org/pods/Unio'>
<img src='https://img.shields.io/cocoapods/l/Unio.svg?style=flat' alt='License' />
</a>
<a href='https://cocoapods.org/pods/Unio'>
<img src='https://img.shields.io/cocoapods/p/Unio.svg?style=flat' alt='Platform' />
</a>
<br/>
<a href='https://github.com/Carthage/Carthage'>
<img src='https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat' alt='Carthage compatible' />
</a>
<a href='https://cocoapods.org/pods/Unio'>
<img src='https://img.shields.io/cocoapods/v/Unio.svg?style=flat' alt='Version' />
</a>
<a href='https://swift.org/package-manager/'>
<img src='https://img.shields.io/badge/Swift%20Package%20Manager-compatible-4BC51D.svg?style=flat' alt='Carthage compatible' />
</a>
</p>

## Introduction
Expand Down Expand Up @@ -222,7 +227,7 @@ class PrimitiveStream<Logic: LogicType> {
Be able to define a subclass of UnioStream like this.

```swift
fianl class GitHubSearchViewStream: UnioStream<GitHubSearchViewStream> {
final class GitHubSearchViewStream: UnioStream<GitHubSearchViewStream> {

init() {
super.init(input: Input(), state: State(), extra: Extra())
Expand Down Expand Up @@ -343,10 +348,21 @@ it, simply add the following line to your Podfile:
pod "Unio"
```

### Swift Package Manager

Simply add the following line to your `Package.swift`:

```
.package(url: "https://github.com/cats-oss/Unio.git", from: "version")
```

## Requirements

- Swift 5 or greater
- iOS 9.0 or greater
- tvOS 10.0 or greater
- watchOS 3.0 or greater
- macOS 10.10 or greater
- [RxSwift](https://github.com/ReactiveX/RxSwift) 5.0 or greater

## License
Expand Down
5 changes: 4 additions & 1 deletion Unio.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@

Pod::Spec.new do |s|
s.name = "Unio"
s.version = "0.6.0"
s.version = "0.7.0"
s.summary = "KeyPath based Unidirectionarl Input / Output framework with RxSwift."
s.homepage = "https://github.com/cats-oss/Unio"
s.license = { :type => "MIT", :file => "LICENSE" }
s.author = { "Taiki Suzuki" => "[email protected]" }
s.ios.deployment_target = "9.0"
s.osx.deployment_target = '10.10'
s.tvos.deployment_target = '10.0'
s.watchos.deployment_target = '3.0'
s.source = { :git => "https://github.com/cats-oss/Unio.git", :tag => "#{s.version}" }
s.source_files = "Unio/**/*.{swift}"
s.dependency 'RxSwift', '~> 5.0'
Expand Down
44 changes: 16 additions & 28 deletions Unio.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
9D9EEC0B228168F800DF5D97 /* RxRelay.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D9EEC0A228168F800DF5D97 /* RxRelay.framework */; };
9D9EEC0C2281699000DF5D97 /* RxRelay.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D9EEC0A228168F800DF5D97 /* RxRelay.framework */; };
9D9EEC0D2281699800DF5D97 /* RxRelay.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 9D9EEC0A228168F800DF5D97 /* RxRelay.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
9D9EEC13228172F400DF5D97 /* RxCocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D2E26A92240D1F200C9EDF7 /* RxCocoa.framework */; };
9D9EEC14228172F900DF5D97 /* RxCocoa.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 9D2E26A92240D1F200C9EDF7 /* RxCocoa.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
9DA555CB2241DE8400EC8CC3 /* BehaviorSubjectType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9DA555CA2241DE8400EC8CC3 /* BehaviorSubjectType.swift */; };
9DA555D32241FC0400EC8CC3 /* AcceptableRelay.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9DA555D22241FC0400EC8CC3 /* AcceptableRelay.swift */; };
9DA555D52241FC6600EC8CC3 /* ValueAccessible.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9DA555D42241FC6600EC8CC3 /* ValueAccessible.swift */; };
Expand Down Expand Up @@ -54,7 +52,6 @@
dstPath = "";
dstSubfolderSpec = 10;
files = (
9D9EEC14228172F900DF5D97 /* RxCocoa.framework in Copy Frameworks */,
9D9EEC0D2281699800DF5D97 /* RxRelay.framework in Copy Frameworks */,
ED74A6432243C43400D4E99C /* RxSwift.framework in Copy Frameworks */,
);
Expand All @@ -80,11 +77,12 @@
9D2E269B2240D1CA00C9EDF7 /* OutputType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OutputType.swift; sourceTree = "<group>"; };
9D2E269C2240D1CA00C9EDF7 /* Dependency.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Dependency.swift; sourceTree = "<group>"; };
9D2E26A82240D1F200C9EDF7 /* RxSwift.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = RxSwift.framework; path = Carthage/Build/iOS/RxSwift.framework; sourceTree = "<group>"; };
9D2E26A92240D1F200C9EDF7 /* RxCocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = RxCocoa.framework; path = Carthage/Build/iOS/RxCocoa.framework; sourceTree = "<group>"; };
9D62B5452362DE7C008F8793 /* Base.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Base.xcconfig; sourceTree = "<group>"; };
9D9EEC0A228168F800DF5D97 /* RxRelay.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = RxRelay.framework; path = Carthage/Build/iOS/RxRelay.framework; sourceTree = "<group>"; };
9DA555CA2241DE8400EC8CC3 /* BehaviorSubjectType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BehaviorSubjectType.swift; sourceTree = "<group>"; };
9DA555D22241FC0400EC8CC3 /* AcceptableRelay.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AcceptableRelay.swift; sourceTree = "<group>"; };
9DA555D42241FC6600EC8CC3 /* ValueAccessible.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ValueAccessible.swift; sourceTree = "<group>"; };
9DA5623F2362DB760048F2B9 /* Unio.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Unio.xcconfig; sourceTree = "<group>"; };
ED6897C022B184EE00B04DA0 /* PrimitiveProperty.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PrimitiveProperty.swift; sourceTree = "<group>"; };
ED74A63C2243C2EE00D4E99C /* PrimitivePropertyTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrimitivePropertyTests.swift; sourceTree = "<group>"; };
ED74A7372243D99D00D4E99C /* WrappersTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WrappersTests.swift; sourceTree = "<group>"; };
Expand All @@ -106,7 +104,6 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
9D9EEC13228172F400DF5D97 /* RxCocoa.framework in Frameworks */,
9D9EEC0C2281699000DF5D97 /* RxRelay.framework in Frameworks */,
ED74A6402243C3DB00D4E99C /* RxSwift.framework in Frameworks */,
9D2E26832240D18500C9EDF7 /* Unio.framework in Frameworks */,
Expand All @@ -123,6 +120,7 @@
9D2E267A2240D18500C9EDF7 /* Products */,
9D2E267B2240D18500C9EDF7 /* Unio */,
9D2E26862240D18500C9EDF7 /* UnioTests */,
9DA5623E2362DB760048F2B9 /* xcconfigs */,
);
sourceTree = "<group>";
};
Expand Down Expand Up @@ -166,7 +164,6 @@
9D2E26A72240D1F200C9EDF7 /* Frameworks */ = {
isa = PBXGroup;
children = (
9D2E26A92240D1F200C9EDF7 /* RxCocoa.framework */,
9D9EEC0A228168F800DF5D97 /* RxRelay.framework */,
9D2E26A82240D1F200C9EDF7 /* RxSwift.framework */,
);
Expand All @@ -185,6 +182,15 @@
path = RxTypes;
sourceTree = "<group>";
};
9DA5623E2362DB760048F2B9 /* xcconfigs */ = {
isa = PBXGroup;
children = (
9D62B5452362DE7C008F8793 /* Base.xcconfig */,
9DA5623F2362DB760048F2B9 /* Unio.xcconfig */,
);
path = xcconfigs;
sourceTree = "<group>";
};
ED74A63E2243C2F200D4E99C /* TestCases */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -349,6 +355,7 @@
/* Begin XCBuildConfiguration section */
9D2E268B2240D18500C9EDF7 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 9D62B5452362DE7C008F8793 /* Base.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
Expand Down Expand Up @@ -413,6 +420,7 @@
};
9D2E268C2240D18500C9EDF7 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 9D62B5452362DE7C008F8793 /* Base.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
Expand Down Expand Up @@ -471,6 +479,7 @@
};
9D2E268E2240D18500C9EDF7 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 9DA5623F2362DB760048F2B9 /* Unio.xcconfig */;
buildSettings = {
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "";
Expand All @@ -480,30 +489,21 @@
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/iOS",
);
INFOPLIST_FILE = Unio/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = tv.abema.Unio;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
PROVISIONING_PROFILE_SPECIFIER = "";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
9D2E268F2240D18500C9EDF7 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 9DA5623F2362DB760048F2B9 /* Unio.xcconfig */;
buildSettings = {
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "";
Expand All @@ -513,24 +513,14 @@
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/iOS",
);
INFOPLIST_FILE = Unio/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = tv.abema.Unio;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
PROVISIONING_PROFILE_SPECIFIER = "";
SKIP_INSTALL = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
};
Expand All @@ -554,7 +544,6 @@
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
Expand All @@ -578,7 +567,6 @@
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
};
Expand Down
2 changes: 1 addition & 1 deletion Unio/Unio.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2019 tv.abema. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>

//! Project version number for Unio.
FOUNDATION_EXPORT double UnioVersionNumber;
Expand Down
9 changes: 4 additions & 5 deletions UnioTests/TestCases/WrappersTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
// Copyright © 2019 tv.abema. All rights reserved.
//

import RxCocoa
import RxRelay
import RxSwift
import XCTest
Expand Down Expand Up @@ -52,10 +51,10 @@ final class WrappersTests: XCTestCase {

#if swift(>=5.1)
let disposable2 = Observable.just(expected)
.bind(to: testTarget.subject)
.subscribe(testTarget.subject.on)
#else
let disposable2 = Observable.just(expected)
.bind(to: testTarget.onEvent(for: \.subject))
.subscribe(testTarget.onEvent(for: \.subject).on)
#endif

XCTAssertEqual(stack.value, expected)
Expand Down Expand Up @@ -95,10 +94,10 @@ final class WrappersTests: XCTestCase {

#if swift(>=5.1)
let disposable2 = Observable.just(expected)
.bind(to: testTarget.relay)
.subscribe(onNext: testTarget.relay)
#else
let disposable2 = Observable.just(expected)
.bind(to: testTarget.accept(for: \.relay))
.subscribe(onNext: { testTarget.accept($0, for: \.relay) })
#endif

XCTAssertEqual(stack.value, expected)
Expand Down
6 changes: 6 additions & 0 deletions xcconfigs/Base.xcconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
TARGETED_DEVICE_FAMILY = 1,2,3,4

MACOSX_DEPLOYMENT_TARGET = 10.10
IPHONEOS_DEPLOYMENT_TARGET = 9.0
WATCHOS_DEPLOYMENT_TARGET = 3.0
TVOS_DEPLOYMENT_TARGET = 10.0
19 changes: 19 additions & 0 deletions xcconfigs/Unio.xcconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
SUPPORTED_PLATFORMS = macosx iphoneos iphonesimulator watchos watchsimulator appletvos appletvsimulator

VALID_ARCHS[sdk=macosx*] = i386 x86_64
VALID_ARCHS[sdk=iphoneos*] = arm64 armv7 armv7s
VALID_ARCHS[sdk=iphonesimulator*] = i386 x86_64
VALID_ARCHS[sdk=watchos*] = armv7k
VALID_ARCHS[sdk=watchsimulator*] = i386
VALID_ARCHS[sdk=appletvos*] = arm64
VALID_ARCHS[sdk=appletvsimulator*] = x86_64

FRAMEWORK_SEARCH_PATHS[sdk=macosx*] = $(inherited) '$(PROJECT_DIR)/Carthage/Build/Mac'
FRAMEWORK_SEARCH_PATHS[sdk=iphone*] = $(inherited) '$(PROJECT_DIR)/Carthage/Build/iOS'
FRAMEWORK_SEARCH_PATHS[sdk=watch*] = $(inherited) '$(PROJECT_DIR)/Carthage/Build/watchOS'
FRAMEWORK_SEARCH_PATHS[sdk=appletv*] = $(inherited) '$(PROJECT_DIR)/Carthage/Build/tvOS'

LD_RUNPATH_SEARCH_PATHS[sdk=macosx*] = $(inherited) '@executable_path/../Frameworks' '@loader_path/../Frameworks'
LD_RUNPATH_SEARCH_PATHS[sdk=iphone*] = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
LD_RUNPATH_SEARCH_PATHS[sdk=watch*] = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
LD_RUNPATH_SEARCH_PATHS[sdk=appletv*] = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'

0 comments on commit a92b299

Please sign in to comment.