Skip to content

Commit 93e4b8c

Browse files
committed
Added NativePromoContainerView.
1 parent f11e6c7 commit 93e4b8c

File tree

4 files changed

+34
-20
lines changed

4 files changed

+34
-20
lines changed

Example App/NativeUIKit.xcodeproj/xcshareddata/xcschemes/watchOS Example.xcscheme

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -54,46 +54,33 @@
5454
debugDocumentVersioning = "YES"
5555
debugServiceExtension = "internal"
5656
allowLocationSimulation = "YES">
57-
<RemoteRunnable
58-
runnableDebuggingMode = "2"
59-
BundleIdentifier = "com.apple.Carousel"
60-
RemotePath = "/(null)">
57+
<BuildableProductRunnable
58+
runnableDebuggingMode = "0">
6159
<BuildableReference
6260
BuildableIdentifier = "primary"
6361
BlueprintIdentifier = "F4C33E2F26C932C8001A28B1"
6462
BuildableName = "watchOS Example.app"
6563
BlueprintName = "watchOS Example"
6664
ReferencedContainer = "container:NativeUIKit.xcodeproj">
6765
</BuildableReference>
68-
</RemoteRunnable>
66+
</BuildableProductRunnable>
6967
</LaunchAction>
7068
<ProfileAction
7169
buildConfiguration = "Release"
7270
shouldUseLaunchSchemeArgsEnv = "YES"
7371
savedToolIdentifier = ""
7472
useCustomWorkingDirectory = "NO"
7573
debugDocumentVersioning = "YES">
76-
<RemoteRunnable
77-
runnableDebuggingMode = "2"
78-
BundleIdentifier = "com.apple.Carousel"
79-
RemotePath = "/(null)">
74+
<BuildableProductRunnable
75+
runnableDebuggingMode = "0">
8076
<BuildableReference
8177
BuildableIdentifier = "primary"
8278
BlueprintIdentifier = "F4C33E2F26C932C8001A28B1"
8379
BuildableName = "watchOS Example.app"
8480
BlueprintName = "watchOS Example"
8581
ReferencedContainer = "container:NativeUIKit.xcodeproj">
8682
</BuildableReference>
87-
</RemoteRunnable>
88-
<MacroExpansion>
89-
<BuildableReference
90-
BuildableIdentifier = "primary"
91-
BlueprintIdentifier = "F4C33E2F26C932C8001A28B1"
92-
BuildableName = "watchOS Example.app"
93-
BlueprintName = "watchOS Example"
94-
ReferencedContainer = "container:NativeUIKit.xcodeproj">
95-
</BuildableReference>
96-
</MacroExpansion>
83+
</BuildableProductRunnable>
9784
</ProfileAction>
9885
<AnalyzeAction
9986
buildConfiguration = "Debug">

Sources/NativeUIKit/Collection/NativePromoCollectionViewCell.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ open class NativePromoCollectionViewCell: SPCollectionViewCell {
3434

3535
open override func commonInit() {
3636
super.commonInit()
37-
layoutMargins = .zero
37+
contentView.layoutMargins = .zero
3838
contentView.addSubview(promoView)
3939
}
4040

Sources/NativeUIKit/Views/NativePromoView.swift

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,4 +123,31 @@ open class NativePromoView: SPView {
123123
return .init(width: size.width, height: button.frame.maxY + layoutMargins.bottom)
124124
}
125125
}
126+
127+
open class NativePromoContainerView: SPView {
128+
129+
// MARK: - Views
130+
131+
public let promoView = NativePromoView()
132+
133+
// MARK: - Init
134+
135+
open override func commonInit() {
136+
super.commonInit()
137+
addSubview(promoView)
138+
}
139+
140+
// MARK: - Layout
141+
142+
open override func layoutSubviews() {
143+
super.layoutSubviews()
144+
promoView.layout(y: layoutMargins.top)
145+
}
146+
147+
open override func sizeThatFits(_ size: CGSize) -> CGSize {
148+
let superSize = super.sizeThatFits(size)
149+
layoutSubviews()
150+
return .init(width: superSize.width, height: promoView.frame.maxY + layoutMargins.bottom)
151+
}
152+
}
126153
#endif

0 commit comments

Comments
 (0)