Skip to content

Commit d2060ba

Browse files
committed
mac os
1 parent 4056e7b commit d2060ba

File tree

10 files changed

+400
-7
lines changed

10 files changed

+400
-7
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ Carthage/Build
3434
# Note: if you ignore the Pods directory, make sure to uncomment
3535
# `pod install` in .travis.yml
3636
#
37-
# Pods/
37+
Pods/
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "1240"
4+
version = "1.3">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "SwiftBloc"
18+
BuildableName = "SwiftBloc"
19+
BlueprintName = "SwiftBloc"
20+
ReferencedContainer = "container:">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
</BuildActionEntries>
24+
</BuildAction>
25+
<TestAction
26+
buildConfiguration = "Debug"
27+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
shouldUseLaunchSchemeArgsEnv = "YES">
30+
<Testables>
31+
<TestableReference
32+
skipped = "NO">
33+
<BuildableReference
34+
BuildableIdentifier = "primary"
35+
BlueprintIdentifier = "SwiftBlocTests"
36+
BuildableName = "SwiftBlocTests"
37+
BlueprintName = "SwiftBlocTests"
38+
ReferencedContainer = "container:">
39+
</BuildableReference>
40+
</TestableReference>
41+
</Testables>
42+
</TestAction>
43+
<LaunchAction
44+
buildConfiguration = "Debug"
45+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
46+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
47+
launchStyle = "0"
48+
useCustomWorkingDirectory = "NO"
49+
ignoresPersistentStateOnLaunch = "NO"
50+
debugDocumentVersioning = "YES"
51+
debugServiceExtension = "internal"
52+
allowLocationSimulation = "YES">
53+
</LaunchAction>
54+
<ProfileAction
55+
buildConfiguration = "Release"
56+
shouldUseLaunchSchemeArgsEnv = "YES"
57+
savedToolIdentifier = ""
58+
useCustomWorkingDirectory = "NO"
59+
debugDocumentVersioning = "YES">
60+
<MacroExpansion>
61+
<BuildableReference
62+
BuildableIdentifier = "primary"
63+
BlueprintIdentifier = "SwiftBloc"
64+
BuildableName = "SwiftBloc"
65+
BlueprintName = "SwiftBloc"
66+
ReferencedContainer = "container:">
67+
</BuildableReference>
68+
</MacroExpansion>
69+
</ProfileAction>
70+
<AnalyzeAction
71+
buildConfiguration = "Debug">
72+
</AnalyzeAction>
73+
<ArchiveAction
74+
buildConfiguration = "Release"
75+
revealArchiveInOrganizer = "YES">
76+
</ArchiveAction>
77+
</Scheme>

Example/Podfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
PODS:
2-
- SwiftBloc (1.0.0)
2+
- SwiftBloc (1.0.1)
33

44
DEPENDENCIES:
55
- SwiftBloc (from `../`)
@@ -9,7 +9,7 @@ EXTERNAL SOURCES:
99
:path: "../"
1010

1111
SPEC CHECKSUMS:
12-
SwiftBloc: 31aad2949ccfe3de54a447868f489c697ef00428
12+
SwiftBloc: c051dd14cfc932200a3fd27d14e12124a4ae7741
1313

1414
PODFILE CHECKSUM: a328c1d5c47373468c0f027e420b98fc6ea4155e
1515

Example/SwiftBloc.xcodeproj/project.pbxproj

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111
047A7BB925ED733700228011 /* BlocContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 047A7BB825ED733700228011 /* BlocContentView.swift */; };
1212
047A7BBB25ED735800228011 /* MainView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 047A7BBA25ED735800228011 /* MainView.swift */; };
1313
047EC4D025EAEE860004C90C /* CounterCubit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 047EC4CF25EAEE860004C90C /* CounterCubit.swift */; };
14+
04B45D1926164D1F0050F1D6 /* Pods_SwiftBloc_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0D9208F1CC2C0172BFA8D1E4 /* Pods_SwiftBloc_Example.framework */; };
15+
04B45D3026164E710050F1D6 /* Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACEB1AFB9204008FA782 /* Tests.swift */; };
1416
04EB15FB25EAC7E8008E0030 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04EB15FA25EAC7E8008E0030 /* SceneDelegate.swift */; };
1517
08611E94466D97B3F329DCE3 /* Pods_SwiftBloc_Tests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 82EC3EC02FB63CEFC4EA0403 /* Pods_SwiftBloc_Tests.framework */; };
16-
2EF31873A1F3203A48F66733 /* Pods_SwiftBloc_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0D9208F1CC2C0172BFA8D1E4 /* Pods_SwiftBloc_Example.framework */; };
1718
607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD51AFB9204008FA782 /* AppDelegate.swift */; };
1819
607FACD81AFB9204008FA782 /* CubitContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD71AFB9204008FA782 /* CubitContentView.swift */; };
1920
607FACDD1AFB9204008FA782 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDC1AFB9204008FA782 /* Images.xcassets */; };
2021
607FACE01AFB9204008FA782 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */; };
21-
607FACEC1AFB9204008FA782 /* Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACEB1AFB9204008FA782 /* Tests.swift */; };
2222
/* End PBXBuildFile section */
2323

2424
/* Begin PBXContainerItemProxy section */
@@ -38,6 +38,7 @@
3838
047A7BB825ED733700228011 /* BlocContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BlocContentView.swift; sourceTree = "<group>"; };
3939
047A7BBA25ED735800228011 /* MainView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainView.swift; sourceTree = "<group>"; };
4040
047EC4CF25EAEE860004C90C /* CounterCubit.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CounterCubit.swift; sourceTree = "<group>"; };
41+
04B45D0D26164BD50050F1D6 /* SwiftBloc_Example.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = SwiftBloc_Example.entitlements; sourceTree = "<group>"; };
4142
04EB15FA25EAC7E8008E0030 /* SceneDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
4243
0D9208F1CC2C0172BFA8D1E4 /* Pods_SwiftBloc_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SwiftBloc_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; };
4344
0DD499F2FF4B6CDD3A8F0679 /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = "<group>"; };
@@ -66,7 +67,7 @@
6667
isa = PBXFrameworksBuildPhase;
6768
buildActionMask = 2147483647;
6869
files = (
69-
2EF31873A1F3203A48F66733 /* Pods_SwiftBloc_Example.framework in Frameworks */,
70+
04B45D1926164D1F0050F1D6 /* Pods_SwiftBloc_Example.framework in Frameworks */,
7071
);
7172
runOnlyForDeploymentPostprocessing = 0;
7273
};
@@ -102,6 +103,7 @@
102103
607FACC71AFB9204008FA782 = {
103104
isa = PBXGroup;
104105
children = (
106+
04B45D0D26164BD50050F1D6 /* SwiftBloc_Example.entitlements */,
105107
043EE4DE25EC197400FAE1E8 /* .swiftlint.yml */,
106108
607FACF51AFB993E008FA782 /* Podspec Metadata */,
107109
607FACD21AFB9204008FA782 /* Example for SwiftBloc */,
@@ -249,11 +251,15 @@
249251
TargetAttributes = {
250252
607FACCF1AFB9204008FA782 = {
251253
CreatedOnToolsVersion = 6.3.1;
254+
DevelopmentTeam = MAVP5V2N7V;
252255
LastSwiftMigration = 1170;
256+
ProvisioningStyle = Automatic;
253257
};
254258
607FACE41AFB9204008FA782 = {
255259
CreatedOnToolsVersion = 6.3.1;
260+
DevelopmentTeam = MAVP5V2N7V;
256261
LastSwiftMigration = 1170;
262+
ProvisioningStyle = Automatic;
257263
TestTargetID = 607FACCF1AFB9204008FA782;
258264
};
259265
};
@@ -397,7 +403,7 @@
397403
isa = PBXSourcesBuildPhase;
398404
buildActionMask = 2147483647;
399405
files = (
400-
607FACEC1AFB9204008FA782 /* Tests.swift in Sources */,
406+
04B45D3026164E710050F1D6 /* Tests.swift in Sources */,
401407
);
402408
runOnlyForDeploymentPostprocessing = 0;
403409
};
@@ -535,13 +541,23 @@
535541
baseConfigurationReference = 5C8F27C1B948611BBB8A3EB5 /* Pods-SwiftBloc_Example.debug.xcconfig */;
536542
buildSettings = {
537543
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
544+
CODE_SIGN_ENTITLEMENTS = SwiftBloc_Example.entitlements;
545+
CODE_SIGN_IDENTITY = "Apple Development";
546+
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
547+
CODE_SIGN_STYLE = Automatic;
548+
DEVELOPMENT_TEAM = MAVP5V2N7V;
538549
INFOPLIST_FILE = SwiftBloc/Info.plist;
550+
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
539551
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
540552
MODULE_NAME = ExampleApp;
541553
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)";
542554
PRODUCT_NAME = "$(TARGET_NAME)";
555+
PROVISIONING_PROFILE_SPECIFIER = "";
556+
"PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = "";
557+
SUPPORTS_MACCATALYST = YES;
543558
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
544559
SWIFT_VERSION = 5.0;
560+
TARGETED_DEVICE_FAMILY = "1,2";
545561
};
546562
name = Debug;
547563
};
@@ -550,20 +566,34 @@
550566
baseConfigurationReference = 3E2125C73E725C0C0E6379E5 /* Pods-SwiftBloc_Example.release.xcconfig */;
551567
buildSettings = {
552568
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
569+
CODE_SIGN_ENTITLEMENTS = SwiftBloc_Example.entitlements;
570+
CODE_SIGN_IDENTITY = "Apple Development";
571+
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
572+
CODE_SIGN_STYLE = Automatic;
573+
DEVELOPMENT_TEAM = MAVP5V2N7V;
553574
INFOPLIST_FILE = SwiftBloc/Info.plist;
575+
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
554576
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
555577
MODULE_NAME = ExampleApp;
556578
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)";
557579
PRODUCT_NAME = "$(TARGET_NAME)";
580+
PROVISIONING_PROFILE_SPECIFIER = "";
581+
"PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = "";
582+
SUPPORTS_MACCATALYST = YES;
558583
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
559584
SWIFT_VERSION = 5.0;
585+
TARGETED_DEVICE_FAMILY = "1,2";
560586
};
561587
name = Release;
562588
};
563589
607FACF31AFB9204008FA782 /* Debug */ = {
564590
isa = XCBuildConfiguration;
565591
baseConfigurationReference = 4B01CD3000816151C6152076 /* Pods-SwiftBloc_Tests.debug.xcconfig */;
566592
buildSettings = {
593+
CODE_SIGN_IDENTITY = "Apple Development";
594+
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
595+
CODE_SIGN_STYLE = Automatic;
596+
DEVELOPMENT_TEAM = MAVP5V2N7V;
567597
FRAMEWORK_SEARCH_PATHS = (
568598
"$(PLATFORM_DIR)/Developer/Library/Frameworks",
569599
"$(inherited)",
@@ -576,6 +606,8 @@
576606
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
577607
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)";
578608
PRODUCT_NAME = "$(TARGET_NAME)";
609+
PROVISIONING_PROFILE_SPECIFIER = "";
610+
"PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = "";
579611
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
580612
SWIFT_VERSION = 5.0;
581613
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SwiftBloc_Example.app/SwiftBloc_Example";
@@ -586,6 +618,10 @@
586618
isa = XCBuildConfiguration;
587619
baseConfigurationReference = 43D4B93CE8F3432B5D3E459C /* Pods-SwiftBloc_Tests.release.xcconfig */;
588620
buildSettings = {
621+
CODE_SIGN_IDENTITY = "Apple Development";
622+
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
623+
CODE_SIGN_STYLE = Automatic;
624+
DEVELOPMENT_TEAM = MAVP5V2N7V;
589625
FRAMEWORK_SEARCH_PATHS = (
590626
"$(PLATFORM_DIR)/Developer/Library/Frameworks",
591627
"$(inherited)",
@@ -594,6 +630,8 @@
594630
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
595631
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)";
596632
PRODUCT_NAME = "$(TARGET_NAME)";
633+
PROVISIONING_PROFILE_SPECIFIER = "";
634+
"PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = "";
597635
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
598636
SWIFT_VERSION = 5.0;
599637
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SwiftBloc_Example.app/SwiftBloc_Example";
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>com.apple.security.app-sandbox</key>
6+
<true/>
7+
<key>com.apple.security.network.client</key>
8+
<true/>
9+
</dict>
10+
</plist>

Package.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ let package = Package(
2121
.target(
2222
name: "SwiftBloc",
2323
path: "Sources"),
24+
.testTarget(
25+
name: "SwiftBlocTests",
26+
path: "Tests"),
2427
]
2528
)
2629

Sources/BlocTest.swift

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
//
2+
// File.swift
3+
//
4+
//
5+
// Created by Kachalov, Victor on 01.04.21.
6+
//
7+
8+
import Foundation
9+
import Combine
10+
11+
final public class BlocTest<S: Equatable, B: Base<S>> {
12+
public static func execute(
13+
description: String,
14+
build: () -> B,
15+
act: ((B) -> Void)?,
16+
wait: TimeInterval? = 0,
17+
expect: (() -> Any)?,
18+
verify: ((Bool, String) -> Void)
19+
) {
20+
print("Running test: \(description)")
21+
var areEqual = false
22+
var states = [S]()
23+
let bloc = build()
24+
let scheduler = ImmediateScheduler.shared
25+
let cancellable = bloc.$state
26+
.subscribe(on: scheduler)
27+
.delay(for: .seconds(wait ?? 0), scheduler: scheduler)
28+
.sink(receiveValue: { value in
29+
print("New state added: \(value)")
30+
states.append(value)
31+
} )
32+
act?(bloc)
33+
if expect != nil {
34+
let expected = expect!()
35+
areEqual = "\(states)" == "\(expected)"
36+
let message = "State received: \(states). \nStates expected: \(expected)"
37+
verify(areEqual, message)
38+
}
39+
cancellable.cancel()
40+
}
41+
}

Tests/BlocTest.swift

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
//
2+
// File.swift
3+
//
4+
//
5+
// Created by Kachalov, Victor on 01.04.21.
6+
//
7+
8+
//import Foundation
9+
//import SwiftBloc
10+
//import Combine
11+
//import XCTest
12+
//
13+
//final public class BlocTest<S: Equatable, B: Base<S>> {
14+
// public static func execute(
15+
// description: String,
16+
// build: () -> B,
17+
// act: ((B) -> Void)?,
18+
// wait: TimeInterval? = 0,
19+
// expect: (() -> Any)?,
20+
// verify: ((B) -> Void)? = nil
21+
// ) {
22+
// print("Running test: \(description)")
23+
// var areEqual = false
24+
// var states = [S]()
25+
// let bloc = build()
26+
// let scheduler = ImmediateScheduler.shared
27+
// let cancellable = bloc.$state
28+
// .subscribe(on: scheduler)
29+
// .delay(for: .seconds(wait ?? 0), scheduler: scheduler)
30+
// .sink(receiveValue: { value in
31+
// print("New state added: \(value)")
32+
// states.append(value)
33+
// } )
34+
// act?(bloc)
35+
// if expect != nil {
36+
// let expected = expect!()
37+
// areEqual = "\(states)" == "\(expected)"
38+
// let message = "State received: \(states). \nStates expected: \(expected)"
39+
// XCTAssert(areEqual, message)
40+
// }
41+
// cancellable.cancel()
42+
// verify?(bloc)
43+
// }
44+
//}

0 commit comments

Comments
 (0)