Skip to content

Commit

Permalink
Remove Combine extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
sunshinejr committed Oct 5, 2019
1 parent 094e23a commit 7e82d4b
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 625 deletions.
17 changes: 10 additions & 7 deletions Examples/Basic/ViewController.swift
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import UIKit
import Moya
import Combine

class ViewController: UITableViewController {
var progressView = UIView()
var repos = NSArray()
var cancellable: AnyCancellable?

override func viewDidLoad() {
super.viewDidLoad()
Expand Down Expand Up @@ -41,11 +39,16 @@ class ViewController: UITableViewController {
}

func downloadZen() {
cancellable = gitHubProvider.requestPublisher(.zen)
.mapString()
.sink(receiveCompletion: { _ in }, receiveValue: { message in
self.showAlert("Zen", message: message)
})
gitHubProvider.request(.zen) { result in
var message = "Couldn't access API"

if case let .success(response) = result {
let jsonString = try? response.mapString()
message = jsonString ?? message
}

self.showAlert("Zen", message: message)
}
}

func uploadGiphy() {
Expand Down
3 changes: 1 addition & 2 deletions Moya.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@ Pod::Spec.new do |s|
s.default_subspec = "Core"
s.swift_version = '5.0'
s.cocoapods_version = '>= 1.4.0'
s.pod_target_xcconfig = { 'OTHER_LDFLAGS' => '-weak_framework Combine' }

s.subspec "Core" do |ss|
ss.source_files = "Sources/Moya/", "Sources/Moya/Combine", "Sources/Moya/Plugins/"
ss.source_files = "Sources/Moya/", "Sources/Moya/Plugins/"
ss.dependency "Alamofire", "5.0.0-rc.2"
ss.framework = "Foundation"
end
Expand Down
30 changes: 0 additions & 30 deletions Moya.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,6 @@
83B0E400A7562256224CB7FF /* AccessTokenPlugin.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC115388D44D0DB7A753E9BB /* AccessTokenPlugin.swift */; };
85850A4122CF5AB50089E731 /* NimbleHelpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85850A4022CF5AB50089E731 /* NimbleHelpers.swift */; };
85B2DBBC221C69620098F59A /* PropertyListEncoding.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85B2DBBB221C69620098F59A /* PropertyListEncoding.swift */; };
85C98000231D2D4000AAAFB2 /* MoyaProvider+Combine.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85C97FFF231D2D4000AAAFB2 /* MoyaProvider+Combine.swift */; };
85C98002231D3EC700AAAFB2 /* MoyaProvider+CombineSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85C98001231D3EC700AAAFB2 /* MoyaProvider+CombineSpec.swift */; };
85C98006231D41E400AAAFB2 /* MoyaPublisher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85C98005231D41E400AAAFB2 /* MoyaPublisher.swift */; };
85C98008231D4BE900AAAFB2 /* AnyPublisher+Response.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85C98007231D4BE900AAAFB2 /* AnyPublisher+Response.swift */; };
85D5277A2302BEF30093E9C1 /* TestImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85D527792302BEF30093E9C1 /* TestImage.swift */; };
85F6042E22A018BB00063320 /* RequestTypeWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85F6042D22A018BB00063320 /* RequestTypeWrapper.swift */; };
8995DF740A59721AA79F5B43 /* MoyaProvider+ReactiveSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = C841AA621AEC61FAEA0CA019 /* MoyaProvider+ReactiveSpec.swift */; };
Expand Down Expand Up @@ -197,10 +193,6 @@
851FFE6DC58E873408D0E8E7 /* MoyaProvider.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = MoyaProvider.swift; sourceTree = "<group>"; };
85850A4022CF5AB50089E731 /* NimbleHelpers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NimbleHelpers.swift; sourceTree = "<group>"; };
85B2DBBB221C69620098F59A /* PropertyListEncoding.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PropertyListEncoding.swift; sourceTree = "<group>"; };
85C97FFF231D2D4000AAAFB2 /* MoyaProvider+Combine.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MoyaProvider+Combine.swift"; sourceTree = "<group>"; };
85C98001231D3EC700AAAFB2 /* MoyaProvider+CombineSpec.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MoyaProvider+CombineSpec.swift"; sourceTree = "<group>"; };
85C98005231D41E400AAAFB2 /* MoyaPublisher.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoyaPublisher.swift; sourceTree = "<group>"; };
85C98007231D4BE900AAAFB2 /* AnyPublisher+Response.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "AnyPublisher+Response.swift"; sourceTree = "<group>"; };
85D527792302BEF30093E9C1 /* TestImage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestImage.swift; sourceTree = "<group>"; };
85F6042D22A018BB00063320 /* RequestTypeWrapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RequestTypeWrapper.swift; sourceTree = "<group>"; };
86F3C0EA472C23E786E23CE9 /* Image.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = Image.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -316,7 +308,6 @@
331A6D3090D9773091435406 /* Moya */ = {
isa = PBXGroup;
children = (
85C97FFE231D2D2D00AAAFB2 /* Combine */,
149749421F8923EC00FA4900 /* AnyEncodable.swift */,
5C2B20158E599EDBE51D7AB2 /* Cancellable.swift */,
3FF1994427C5440527B03B31 /* Endpoint.swift */,
Expand Down Expand Up @@ -408,16 +399,6 @@
path = Plugins;
sourceTree = "<group>";
};
85C97FFE231D2D2D00AAAFB2 /* Combine */ = {
isa = PBXGroup;
children = (
85C98007231D4BE900AAAFB2 /* AnyPublisher+Response.swift */,
85C98005231D41E400AAAFB2 /* MoyaPublisher.swift */,
85C97FFF231D2D4000AAAFB2 /* MoyaProvider+Combine.swift */,
);
path = Combine;
sourceTree = "<group>";
};
85D527782302B4CC0093E9C1 /* MoyaTests */ = {
isa = PBXGroup;
children = (
Expand All @@ -427,7 +408,6 @@
C79C5F376B4A2C3F70051980 /* Error+MoyaSpec.swift */,
7F112022D8F42844A7D5CB5C /* ErrorTests.swift */,
819334FE5D32EFB82599D482 /* MethodSpec.swift */,
85C98001231D3EC700AAAFB2 /* MoyaProvider+CombineSpec.swift */,
C841AA621AEC61FAEA0CA019 /* MoyaProvider+ReactiveSpec.swift */,
4C7A20CC38EB5A0221E6EA34 /* MoyaProvider+RxSpec.swift */,
82E52DC541FD052ABA625D2A /* MoyaProviderIntegrationTests.swift */,
Expand Down Expand Up @@ -854,21 +834,18 @@
49C61E884A595E94758B5643 /* Endpoint.swift in Sources */,
FB223B5C3B7D4AA5261E25EA /* Image.swift in Sources */,
EDBA10DB0D0E35C1474AAB4D /* Moya+Alamofire.swift in Sources */,
85C98000231D2D4000AAAFB2 /* MoyaProvider+Combine.swift in Sources */,
15D3A2BD1223B59E2BBE09F0 /* MoyaError.swift in Sources */,
59BC4B9B9D0D6F9C060E5620 /* MoyaProvider+Defaults.swift in Sources */,
149749431F8923EC00FA4900 /* AnyEncodable.swift in Sources */,
9854C1DBF14818CCA76AEC7F /* MoyaProvider+Internal.swift in Sources */,
147E26EC1F5B14B300C1F513 /* Task.swift in Sources */,
149749451F892E2F00FA4900 /* URLRequest+Encoding.swift in Sources */,
85C98008231D4BE900AAAFB2 /* AnyPublisher+Response.swift in Sources */,
5BCAACCA268FEA0DAB07F998 /* MoyaProvider.swift in Sources */,
61633F6E85FB39A4707A6167 /* MultipartFormData.swift in Sources */,
5054F87AFF61EAC0097F88BD /* MultiTarget.swift in Sources */,
BEAA605B30BE7651BA5C61A4 /* Plugin.swift in Sources */,
83B0E400A7562256224CB7FF /* AccessTokenPlugin.swift in Sources */,
B5A7124CF285D8EC7F89C1AD /* CredentialsPlugin.swift in Sources */,
85C98006231D41E400AAAFB2 /* MoyaPublisher.swift in Sources */,
1446FBB31F214C5200C1EFF2 /* URL+Moya.swift in Sources */,
4A609CED953E8A6C59AD01A1 /* NetworkActivityPlugin.swift in Sources */,
1FD44D9E21CEA6B6221807EF /* NetworkLoggerPlugin.swift in Sources */,
Expand Down Expand Up @@ -926,7 +903,6 @@
files = (
A6304A7E74FA3B04C9B10B63 /* AccessTokenPluginSpec.swift in Sources */,
2C7132B56A7B129E12BAACAC /* EndpointSpec.swift in Sources */,
85C98002231D3EC700AAAFB2 /* MoyaProvider+CombineSpec.swift in Sources */,
78A2D3991F44BACD00C9E122 /* RxTestHelpers.swift in Sources */,
53376123902C6A22A44DB88E /* Error+MoyaSpec.swift in Sources */,
78A2D39B1F44D45100C9E122 /* Single+MoyaSpec.swift in Sources */,
Expand Down Expand Up @@ -1161,9 +1137,6 @@
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MACOSX_DEPLOYMENT_TARGET = 10.12;
OTHER_LDFLAGS = $OTHER_LDFLAGS_XCODE11;
OTHER_LDFLAGS_XCODE10 = "";
OTHER_LDFLAGS_XCODE11 = "-weak_framework Combine";
SDKROOT = macosx;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 5.0;
Expand Down Expand Up @@ -1485,9 +1458,6 @@
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MACOSX_DEPLOYMENT_TARGET = 10.12;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = $OTHER_LDFLAGS_XCODE11;
OTHER_LDFLAGS_XCODE10 = "";
OTHER_LDFLAGS_XCODE11 = "-weak_framework Combine";
SDKROOT = macosx;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 5.0;
Expand Down
10 changes: 0 additions & 10 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,16 +149,6 @@ If this is your first time using Carthage in the project, you'll need to go thro

> NOTE: At this time, Carthage does not provide a way to build only specific repository submodules. All submodules and their dependencies will be built with the above command. However, you don't need to copy frameworks you aren't using into your project. For instance, if you aren't using `ReactiveSwift`, feel free to delete that framework along with `ReactiveMoya` from the Carthage Build directory after `carthage update` completes. Or if you are using `ReactiveSwift` but not `RxSwift`, then `RxMoya`, `RxTest`, `RxCocoa`, etc. can safely be deleted.
#### Moya 14+, Carthage and Xcode 10

If you are using this specific stack (no SPM/CocoaPods, no Xcode 11), you need to do a little bit more in order to install Moya. This is because Xcode 10 doesn't see Combine as a framework and so it cannot "weakly link it".
Below is a script that should get you through the installation process:
```bash
carthage update Moya --platform iOS --no-build
./Carthage/Checkouts/Moya/scripts/carthage-xcode10-compat.sh
carthage build Moya --platform iOS
```

### Manually

- Open up Terminal, `cd` into your top-level project directory, and run the following command *if* your project is not initialized as a git repository:
Expand Down
120 changes: 0 additions & 120 deletions Sources/Moya/Combine/AnyPublisher+Response.swift

This file was deleted.

62 changes: 0 additions & 62 deletions Sources/Moya/Combine/MoyaProvider+Combine.swift

This file was deleted.

42 changes: 0 additions & 42 deletions Sources/Moya/Combine/MoyaPublisher.swift

This file was deleted.

Loading

0 comments on commit 7e82d4b

Please sign in to comment.