Skip to content

Commit 4dc450e

Browse files
author
shayanbo
committed
done
1 parent aa04219 commit 4dc450e

File tree

715 files changed

+44736
-10
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

715 files changed

+44736
-10
lines changed

ObjCUI.xcodeproj/project.pbxproj

+53
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10+
658FE41DA548CFAB308F2D1F /* libPods-ObjCUI.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3C31CB6E895E9D1651947CD2 /* libPods-ObjCUI.a */; };
1011
D4CB304B29BA1B280055BEE0 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = D4CB304A29BA1B280055BEE0 /* AppDelegate.m */; };
1112
D4CB305129BA1B280055BEE0 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D4CB305029BA1B280055BEE0 /* ViewController.m */; };
1213
D4CB305629BA1B290055BEE0 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D4CB305529BA1B290055BEE0 /* Assets.xcassets */; };
@@ -17,6 +18,8 @@
1718
/* End PBXBuildFile section */
1819

1920
/* Begin PBXFileReference section */
21+
3C31CB6E895E9D1651947CD2 /* libPods-ObjCUI.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-ObjCUI.a"; sourceTree = BUILT_PRODUCTS_DIR; };
22+
561332504C1BD10E732DA144 /* Pods-ObjCUI.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ObjCUI.debug.xcconfig"; path = "Target Support Files/Pods-ObjCUI/Pods-ObjCUI.debug.xcconfig"; sourceTree = "<group>"; };
2023
D4CB304629BA1B280055BEE0 /* ObjCUI.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ObjCUI.app; sourceTree = BUILT_PRODUCTS_DIR; };
2124
D4CB304929BA1B280055BEE0 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
2225
D4CB304A29BA1B280055BEE0 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
@@ -30,24 +33,46 @@
3033
D4CB306329BA1D1C0055BEE0 /* ObjCUI.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ObjCUI.m; sourceTree = "<group>"; };
3134
D4CB306529BA2E410055BEE0 /* ViewModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewModel.h; sourceTree = "<group>"; };
3235
D4CB306629BA2E410055BEE0 /* ViewModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewModel.m; sourceTree = "<group>"; };
36+
D67BDA0F06DB910E02DFA818 /* Pods-ObjCUI.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ObjCUI.release.xcconfig"; path = "Target Support Files/Pods-ObjCUI/Pods-ObjCUI.release.xcconfig"; sourceTree = "<group>"; };
3337
/* End PBXFileReference section */
3438

3539
/* Begin PBXFrameworksBuildPhase section */
3640
D4CB304329BA1B280055BEE0 /* Frameworks */ = {
3741
isa = PBXFrameworksBuildPhase;
3842
buildActionMask = 2147483647;
3943
files = (
44+
658FE41DA548CFAB308F2D1F /* libPods-ObjCUI.a in Frameworks */,
4045
);
4146
runOnlyForDeploymentPostprocessing = 0;
4247
};
4348
/* End PBXFrameworksBuildPhase section */
4449

4550
/* Begin PBXGroup section */
51+
2B446175668636C1364F321F /* Pods */ = {
52+
isa = PBXGroup;
53+
children = (
54+
561332504C1BD10E732DA144 /* Pods-ObjCUI.debug.xcconfig */,
55+
D67BDA0F06DB910E02DFA818 /* Pods-ObjCUI.release.xcconfig */,
56+
);
57+
name = Pods;
58+
path = Pods;
59+
sourceTree = "<group>";
60+
};
61+
BBEC6E92CBE7C4273257EDB1 /* Frameworks */ = {
62+
isa = PBXGroup;
63+
children = (
64+
3C31CB6E895E9D1651947CD2 /* libPods-ObjCUI.a */,
65+
);
66+
name = Frameworks;
67+
sourceTree = "<group>";
68+
};
4669
D4CB303D29BA1B280055BEE0 = {
4770
isa = PBXGroup;
4871
children = (
4972
D4CB304829BA1B280055BEE0 /* ObjCUI */,
5073
D4CB304729BA1B280055BEE0 /* Products */,
74+
2B446175668636C1364F321F /* Pods */,
75+
BBEC6E92CBE7C4273257EDB1 /* Frameworks */,
5176
);
5277
sourceTree = "<group>";
5378
};
@@ -85,6 +110,7 @@
85110
isa = PBXNativeTarget;
86111
buildConfigurationList = D4CB305F29BA1B290055BEE0 /* Build configuration list for PBXNativeTarget "ObjCUI" */;
87112
buildPhases = (
113+
C3559268C8CE67860755E790 /* [CP] Check Pods Manifest.lock */,
88114
D4CB304229BA1B280055BEE0 /* Sources */,
89115
D4CB304329BA1B280055BEE0 /* Frameworks */,
90116
D4CB304429BA1B280055BEE0 /* Resources */,
@@ -142,6 +168,31 @@
142168
};
143169
/* End PBXResourcesBuildPhase section */
144170

171+
/* Begin PBXShellScriptBuildPhase section */
172+
C3559268C8CE67860755E790 /* [CP] Check Pods Manifest.lock */ = {
173+
isa = PBXShellScriptBuildPhase;
174+
buildActionMask = 2147483647;
175+
files = (
176+
);
177+
inputFileListPaths = (
178+
);
179+
inputPaths = (
180+
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
181+
"${PODS_ROOT}/Manifest.lock",
182+
);
183+
name = "[CP] Check Pods Manifest.lock";
184+
outputFileListPaths = (
185+
);
186+
outputPaths = (
187+
"$(DERIVED_FILE_DIR)/Pods-ObjCUI-checkManifestLockResult.txt",
188+
);
189+
runOnlyForDeploymentPostprocessing = 0;
190+
shellPath = /bin/sh;
191+
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
192+
showEnvVarsInLog = 0;
193+
};
194+
/* End PBXShellScriptBuildPhase section */
195+
145196
/* Begin PBXSourcesBuildPhase section */
146197
D4CB304229BA1B280055BEE0 /* Sources */ = {
147198
isa = PBXSourcesBuildPhase;
@@ -281,6 +332,7 @@
281332
};
282333
D4CB306029BA1B290055BEE0 /* Debug */ = {
283334
isa = XCBuildConfiguration;
335+
baseConfigurationReference = 561332504C1BD10E732DA144 /* Pods-ObjCUI.debug.xcconfig */;
284336
buildSettings = {
285337
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
286338
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
@@ -307,6 +359,7 @@
307359
};
308360
D4CB306129BA1B290055BEE0 /* Release */ = {
309361
isa = XCBuildConfiguration;
362+
baseConfigurationReference = D67BDA0F06DB910E02DFA818 /* Pods-ObjCUI.release.xcconfig */;
310363
buildSettings = {
311364
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
312365
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;

ObjCUI.xcodeproj/xcuserdata/shayanbo.xcuserdatad/xcschemes/xcschememanagement.plist

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<key>ObjCUI.xcscheme_^#shared#^_</key>
88
<dict>
99
<key>orderHint</key>
10-
<integer>0</integer>
10+
<integer>4</integer>
1111
</dict>
1212
</dict>
1313
</dict>

ObjCUI.xcworkspace/contents.xcworkspacedata

+10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
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>IDEDidComputeMac32BitWarning</key>
6+
<true/>
7+
</dict>
8+
</plist>
Binary file not shown.

ObjCUI/ObjCUI.h

+6
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,10 @@ UIStackView *VStack(UIStackViewDistribution distribution, NSArray<UIView *> *sub
1717

1818
UIStackView *HStack(UIStackViewDistribution distribution, NSArray<UIView *> *subviews);
1919

20+
UIView *HSpace(CGFloat width);
21+
22+
UIView *VSpace(CGFloat height);
23+
24+
UIView *AnySpace(void);
25+
2026
NS_ASSUME_NONNULL_END

ObjCUI/ObjCUI.m

+16
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,19 @@
2222
v.distribution = distribution;
2323
return v;
2424
}
25+
26+
UIView *HSpace(CGFloat width) {
27+
UIView *v = [[UIView alloc] init];
28+
[v.widthAnchor constraintEqualToConstant:width].active = YES;
29+
return v;
30+
}
31+
32+
UIView *VSpace(CGFloat height) {
33+
UIView *v = [[UIView alloc] init];
34+
[v.heightAnchor constraintEqualToConstant:height].active = YES;
35+
return v;
36+
}
37+
38+
UIView *AnySpace() {
39+
return [[UIView alloc] init];
40+
}

ObjCUI/ViewController.m

+19-7
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,14 @@
77

88
#import <ReactiveCocoa/ReactiveCocoa.h>
99
#import <SDWebImage/SDWebImage.h>
10+
#import <Masonry/Masonry.h>
1011

1112
#import "ViewController.h"
1213
#import "ViewModel.h"
1314
#import "ObjCUI.h"
1415

1516
#define Observe(target, keypath) [target rac_valuesForKeyPath:NSStringFromSelector(@selector(keypath)) observer:target]
1617

17-
/**
18-
## Demo Project for using UIKit in a `SwiftUI` way
19-
*/
20-
2118
@interface ViewController ()
2219

2320
@property (nonatomic, strong) ViewModel *viewModel;
@@ -27,7 +24,7 @@ @interface ViewController ()
2724
@implementation ViewController
2825

2926
- (void)viewDidLoad {
30-
[super viewDidLoad];
27+
self.view.backgroundColor = [UIColor whiteColor];
3128

3229
/// ViewModel
3330
ViewModel *vm = [[ViewModel alloc] init];
@@ -36,24 +33,39 @@ - (void)viewDidLoad {
3633
/// View
3734
UIView *v = HStack(fill, @[
3835
AvatarView(vm),
36+
HSpace(8),
3937
VStack(fill, @[
38+
VSpace(20),
4039
NameView(vm),
40+
AnySpace(),
4141
TimeView(vm),
42+
VSpace(20),
4243
])
4344
]);
4445

4546
[self.view addSubview:v];
46-
v.frame = self.view.bounds;
47-
v.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
47+
[v mas_makeConstraints:^(MASConstraintMaker *make) {
48+
make.center.equalTo(self.view);
49+
[make install];
50+
}];
4851
}
4952

5053
static UIView *AvatarView(ViewModel *viewModel) {
5154
UIImageView *img = [UIImageView new];
55+
img.layer.cornerRadius = 50;
56+
img.layer.masksToBounds = YES;
57+
img.layer.borderColor = [UIColor blackColor].CGColor;
58+
img.layer.borderWidth = 1;
59+
[img.widthAnchor constraintEqualToConstant:100].active = YES;
60+
[img.heightAnchor constraintEqualToConstant:100].active = YES;
5261
img.userInteractionEnabled = YES;
62+
5363
UITapGestureRecognizer *tap = [UITapGestureRecognizer new];
64+
[img addGestureRecognizer:tap];
5465
[[tap rac_gestureSignal] subscribeNext:^(id x) {
5566
[viewModel updateName: @"Yanbo Sha"];
5667
}];
68+
5769
[Observe(viewModel, avatarUrl) subscribeNext:^(id x) {
5870
[img sd_setImageWithURL:[NSURL URLWithString:x]];
5971
}];

ObjCUI/ViewModel.m

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ - (instancetype)init {
2222
if (self) {
2323
/// load mock data
2424
self.name = @"Rock";
25-
self.avatarUrl = @"";
26-
self.time = @"2023-03-09 12:00:00";
25+
self.avatarUrl = @"https://miro.medium.com/v2/resize:fill:100:100/1*kOyC7Snkp0xpEFJCdIO4Yg.jpeg";
26+
self.time = @"Born in: 1992.11.23";
2727
}
2828
return self;
2929
}

Podfile

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
platform :ios, '11.0'
3+
4+
ENV['SWIFT_VERSION'] = '5'
5+
6+
target 'ObjCUI' do
7+
8+
pod 'ReactiveCocoa', '~>2.0.0'
9+
pod 'SDWebImage'
10+
pod 'Masonry'
11+
12+
end

Podfile.lock

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
PODS:
2+
- Masonry (1.1.0)
3+
- ReactiveCocoa (2.0):
4+
- ReactiveCocoa/Core (= 2.0)
5+
- ReactiveCocoa/no-arc (= 2.0)
6+
- ReactiveCocoa/RACExtensions (= 2.0)
7+
- ReactiveCocoa/Core (2.0):
8+
- ReactiveCocoa/no-arc
9+
- ReactiveCocoa/no-arc (2.0)
10+
- ReactiveCocoa/RACExtensions (2.0):
11+
- ReactiveCocoa/Core
12+
- SDWebImage (5.15.5):
13+
- SDWebImage/Core (= 5.15.5)
14+
- SDWebImage/Core (5.15.5)
15+
16+
DEPENDENCIES:
17+
- Masonry
18+
- ReactiveCocoa (~> 2.0.0)
19+
- SDWebImage
20+
21+
SPEC REPOS:
22+
trunk:
23+
- Masonry
24+
- ReactiveCocoa
25+
- SDWebImage
26+
27+
SPEC CHECKSUMS:
28+
Masonry: 678fab65091a9290e40e2832a55e7ab731aad201
29+
ReactiveCocoa: c5347d7b1c348d22a85800e14e89da84c5254cfb
30+
SDWebImage: fd7e1a22f00303e058058278639bf6196ee431fe
31+
32+
PODFILE CHECKSUM: 2ba464d620ec900e241ab851664fefbb0439d2f1
33+
34+
COCOAPODS: 1.12.0

Pods/Headers/Private/Masonry/MASCompositeConstraint.h

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Pods/Headers/Private/Masonry/MASConstraint+Private.h

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Pods/Headers/Private/Masonry/MASConstraint.h

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Pods/Headers/Private/Masonry/MASConstraintMaker.h

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Pods/Headers/Private/Masonry/MASLayoutConstraint.h

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Pods/Headers/Private/Masonry/MASUtilities.h

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Pods/Headers/Private/Masonry/MASViewAttribute.h

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Pods/Headers/Private/Masonry/MASViewConstraint.h

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Pods/Headers/Private/Masonry/Masonry.h

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Pods/Headers/Private/Masonry/NSArray+MASAdditions.h

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Pods/Headers/Private/Masonry/NSArray+MASShorthandAdditions.h

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Pods/Headers/Private/Masonry/NSLayoutConstraint+MASDebugAdditions.h

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Pods/Headers/Private/Masonry/View+MASAdditions.h

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Pods/Headers/Private/Masonry/View+MASShorthandAdditions.h

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Pods/Headers/Private/Masonry/ViewController+MASAdditions.h

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Pods/Headers/Private/ReactiveCocoa/NSData+RACSupport.h

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Pods/Headers/Private/ReactiveCocoa/NSFileHandle+RACSupport.h

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Pods/Headers/Private/ReactiveCocoa/NSNotificationCenter+RACSupport.h

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Pods/Headers/Private/ReactiveCocoa/NSString+RACSupport.h

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Pods/Headers/Private/ReactiveCocoa/RACObjCRuntime.h

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Pods/Headers/Private/ReactiveCocoa/ReactiveCocoa/NSArray+RACSequenceAdditions.h

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Pods/Headers/Private/ReactiveCocoa/ReactiveCocoa/NSDictionary+RACSequenceAdditions.h

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Pods/Headers/Private/ReactiveCocoa/ReactiveCocoa/NSEnumerator+RACSequenceAdditions.h

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Pods/Headers/Private/ReactiveCocoa/ReactiveCocoa/NSInvocation+RACTypeParsing.h

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Pods/Headers/Private/ReactiveCocoa/ReactiveCocoa/NSObject+RACDeallocating.h

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Pods/Headers/Private/ReactiveCocoa/ReactiveCocoa/NSObject+RACDescription.h

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Pods/Headers/Private/ReactiveCocoa/ReactiveCocoa/NSObject+RACKVOWrapper.h

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Pods/Headers/Private/ReactiveCocoa/ReactiveCocoa/NSObject+RACLifting.h

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Pods/Headers/Private/ReactiveCocoa/ReactiveCocoa/NSObject+RACPropertySubscribing.h

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Pods/Headers/Private/ReactiveCocoa/ReactiveCocoa/NSObject+RACSelectorSignal.h

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)