Skip to content
This repository was archived by the owner on Sep 8, 2025. It is now read-only.

Commit d88a745

Browse files
authored
Merge pull request #314 from icerockdev/develop
Release 0.2.2
2 parents 20fcb75 + 7ad2152 commit d88a745

File tree

14 files changed

+254
-173
lines changed

14 files changed

+254
-173
lines changed

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -209,15 +209,15 @@ allprojects {
209209
project build.gradle
210210
```groovy
211211
dependencies {
212-
commonMainApi("dev.icerock.moko:widgets:0.2.1")
213-
214-
commonMainApi("dev.icerock.moko:widgets-bottomsheet:0.2.1") // show bottom sheets
215-
commonMainApi("dev.icerock.moko:widgets-collection:0.2.1") // collection widget
216-
commonMainApi("dev.icerock.moko:widgets-datetime-picker:0.2.1") // show datepicker
217-
commonMainApi("dev.icerock.moko:widgets-image-network:0.2.1") // images with load from url
218-
commonMainApi("dev.icerock.moko:widgets-sms:0.2.1") // input with sms autofill
219-
commonMainApi("dev.icerock.moko:widgets-media:0.2.1") // moko-media integration
220-
commonMainApi("dev.icerock.moko:widgets-permissions:0.2.1") // moko-permissions integration
212+
commonMainApi("dev.icerock.moko:widgets:0.2.2")
213+
214+
commonMainApi("dev.icerock.moko:widgets-bottomsheet:0.2.2") // show bottom sheets
215+
commonMainApi("dev.icerock.moko:widgets-collection:0.2.2") // collection widget
216+
commonMainApi("dev.icerock.moko:widgets-datetime-picker:0.2.2") // show datepicker
217+
commonMainApi("dev.icerock.moko:widgets-image-network:0.2.2") // images with load from url
218+
commonMainApi("dev.icerock.moko:widgets-sms:0.2.2") // input with sms autofill
219+
commonMainApi("dev.icerock.moko:widgets-media:0.2.2") // moko-media integration
220+
commonMainApi("dev.icerock.moko:widgets-permissions:0.2.2") // moko-permissions integration
221221
}
222222
```
223223

@@ -230,7 +230,7 @@ buildscript {
230230
}
231231
232232
dependencies {
233-
classpath "dev.icerock.moko.widgets:gradle-plugin:0.2.1"
233+
classpath "dev.icerock.moko.widgets:gradle-plugin:0.2.2"
234234
}
235235
}
236236
```

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[versions]
22
kotlinVersion = "1.8.10"
33

4-
mokoWidgetsVersion = "0.2.1"
4+
mokoWidgetsVersion = "0.2.2"
55
mokoResourcesVersion = "0.21.2"
66
mokoMvvmVersion = "0.16.0"
77
mokoFieldsVersion = "0.12.0"

moko-widgets-bottomsheet.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |spec|
22
spec.name = 'moko-widgets-bottomsheet'
3-
spec.version = '0.1.0'
3+
spec.version = '0.2.2'
44
spec.homepage = 'https://github.com/icerockdev/moko-widgets'
55
spec.source = { :git => "https://github.com/icerockdev/moko-widgets.git", :tag => "release/#{spec.version}" }
66
spec.authors = 'IceRock Development'
@@ -11,7 +11,7 @@ Pod::Spec.new do |spec|
1111
spec.source_files = "widgets-bottomSheet/src/iosMain/swift/**/*.{h,m,swift}"
1212
spec.resources = "widgets-bottomSheet/src/iosMain/bundle/**/*"
1313

14-
spec.dependency 'FloatingPanel', '~> 1.7.2'
14+
spec.dependency 'FloatingPanel', '~> 2.6.1'
1515

1616
spec.ios.deployment_target = '11.0'
1717
spec.swift_version = '5.0'

moko-widgets-collection.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |spec|
22
spec.name = 'moko-widgets-collection'
3-
spec.version = '0.1.0'
3+
spec.version = '0.2.2'
44
spec.homepage = 'https://github.com/icerockdev/moko-widgets'
55
spec.source = { :git => "https://github.com/icerockdev/moko-widgets.git", :tag => "release/#{spec.version}" }
66
spec.authors = 'IceRock Development'

moko-widgets-datetime-picker.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |spec|
22
spec.name = 'moko-widgets-datetime-picker'
3-
spec.version = '0.1.0'
3+
spec.version = '0.2.2'
44
spec.homepage = 'https://github.com/icerockdev/moko-widgets'
55
spec.source = { :git => "https://github.com/icerockdev/moko-widgets.git", :tag => "release/#{spec.version}" }
66
spec.authors = 'IceRock Development'
@@ -11,7 +11,7 @@ Pod::Spec.new do |spec|
1111
spec.source_files = "widgets-datetime-picker/src/iosMain/swift/**/*.{h,m,swift}"
1212
spec.resources = "widgets-datetime-picker/src/iosMain/bundle/**/*"
1313

14-
spec.dependency 'FloatingPanel', '~> 1.7.2'
14+
spec.dependency 'FloatingPanel', '~> 2.6.1'
1515

1616
spec.ios.deployment_target = '11.0'
1717
spec.swift_version = '5.0'

moko-widgets-image-network.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |spec|
22
spec.name = 'moko-widgets-image-network'
3-
spec.version = '0.1.0'
3+
spec.version = '0.2.2'
44
spec.homepage = 'https://github.com/icerockdev/moko-widgets'
55
spec.source = { :git => "https://github.com/icerockdev/moko-widgets.git", :tag => "release/#{spec.version}" }
66
spec.authors = 'IceRock Development'

sample/ios-app/Podfile.lock

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
PODS:
2-
- FloatingPanel (1.7.2)
3-
- moko-widgets-bottomsheet (0.1.0):
4-
- FloatingPanel (~> 1.7.2)
2+
- FloatingPanel (2.6.1)
3+
- moko-widgets-bottomsheet (0.2.0):
4+
- FloatingPanel (~> 2.6.1)
55
- moko-widgets-collection (0.1.0)
6-
- moko-widgets-datetime-picker (0.1.0):
7-
- FloatingPanel (~> 1.7.2)
6+
- moko-widgets-datetime-picker (0.2.0):
7+
- FloatingPanel (~> 2.6.1)
88
- moko-widgets-image-network (0.1.0):
99
- SDWebImage (~> 5.0)
1010
- mppLibraryIos (0.1.0)
@@ -41,15 +41,15 @@ EXTERNAL SOURCES:
4141
:path: "../mpp-library"
4242

4343
SPEC CHECKSUMS:
44-
FloatingPanel: b275a35d0a09be4bd37025e710a6a1d063bfc161
45-
moko-widgets-bottomsheet: 302953af27d9bcb6b0f0f51511ccce5e8ff3aa92
44+
FloatingPanel: de6bb891912ede28da7b1140f7b583c474fec28a
45+
moko-widgets-bottomsheet: 45cb9eec56ad3d44f0f3f81421f1ae81b671cfdb
4646
moko-widgets-collection: 722c6fca0b0dcab0b54fdb674b4638d4f715434c
47-
moko-widgets-datetime-picker: 0d8e11202cfc6041ca70234f2e6994900161fb04
47+
moko-widgets-datetime-picker: d25eb6926078eae46a311af26294c78b09f0058d
4848
moko-widgets-image-network: 074870717767dfcc1a0e942a0a070ad183c01195
4949
mppLibraryIos: 72c3984fbaa53978d678e62096fd613e67839f0c
5050
MultiPlatformLibrary: 176fb8ade516666cd47e93de1b71ba0441a541bb
5151
SDWebImage: 7edb9c3ea661e77a66661f7f044de8c1b55d1120
5252

5353
PODFILE CHECKSUM: dd6f9b7e6c038aff8581037bf3a09cf3c1c947f9
5454

55-
COCOAPODS: 1.11.3
55+
COCOAPODS: 1.12.0

widgets-bottomsheet/src/iosMain/swift/BottomSheetController.swift

Lines changed: 36 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import FloatingPanel
77

88
private var AssociatedDelegateHandle: UInt8 = 0
99

10-
@objc public class BottomSheetController: NSObject, FloatingPanelControllerDelegate {
10+
@objc public class BottomSheetController: NSObject {
1111

1212
private weak var controller: FloatingPanelController?
1313
private var onDismiss: ((Bool) -> Void)?
@@ -48,6 +48,9 @@ private var AssociatedDelegateHandle: UInt8 = 0
4848
fpc.delegate = delegate
4949
fpc.backdropView.backgroundColor = UIColor.black
5050
fpc.isRemovalInteractionEnabled = true
51+
let surface = SurfaceAppearance()
52+
surface.cornerRadius = 14
53+
fpc.surfaceView.appearance = surface
5154

5255
view.superview?.layer.maskedCorners = [CACornerMask.layerMinXMinYCorner, CACornerMask.layerMaxXMinYCorner]
5356
view.superview?.layer.masksToBounds = true
@@ -76,44 +79,52 @@ class FloatingDelegate: FloatingPanelControllerDelegate {
7679
self.onDismiss = onDismiss
7780
}
7881

79-
func floatingPanel(_ vc: FloatingPanelController, layoutFor newCollection: UITraitCollection) -> FloatingPanelLayout? {
82+
func floatingPanel(_ vc: FloatingPanelController, layoutFor newCollection: UITraitCollection) -> FloatingPanelLayout {
8083
return floatingLayout
8184
}
8285

8386
func floatingPanelDidEndDecelerating(_ vc: FloatingPanelController) {
84-
if vc.position == .hidden {
87+
if vc.state == .hidden {
8588
vc.removePanelFromParent(animated: true)
8689
vc.dismiss(animated: false, completion: nil)
8790
onDismiss(false)
8891
}
8992
}
9093

91-
func floatingPanelDidEndRemove(_ vc: FloatingPanelController) {
94+
func floatingPanelDidRemove(_ vc: FloatingPanelController) {
9295
onDismiss(false)
9396
}
9497
}
9598

9699
class BottomSheetLayout: FloatingPanelLayout {
97-
var initialPosition: FloatingPanelPosition = .full
98-
99-
private let preferredHeight: CGFloat
100-
101-
init(preferredHeight: CGFloat) {
102-
self.preferredHeight = preferredHeight
103-
}
104-
105-
func insetFor(position: FloatingPanelPosition) -> CGFloat? {
106-
switch (position) {
107-
case .half: return 0
108-
case .full: return UIScreen.main.bounds.size.height - preferredHeight - 30.0
109-
case .tip: return 0
110-
case .hidden: return 0
100+
private let preferredHeight: CGFloat
101+
102+
var position: FloatingPanelPosition {
103+
return .bottom
104+
}
105+
106+
var initialState: FloatingPanelState {
107+
return .full
108+
}
109+
110+
var anchors: [FloatingPanelState : FloatingPanelLayoutAnchoring] {
111+
return [
112+
.full: FloatingPanelLayoutAnchor(absoluteInset: preferredHeight, edge: .bottom, referenceGuide: .safeArea)
113+
]
114+
}
115+
116+
init(preferredHeight: CGFloat) {
117+
self.preferredHeight = preferredHeight
118+
}
119+
120+
func prepareLayout(surfaceView: UIView, in view: UIView) -> [NSLayoutConstraint] {
121+
return [
122+
surfaceView.leftAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leftAnchor, constant: 0.0),
123+
surfaceView.rightAnchor.constraint(equalTo: view.safeAreaLayoutGuide.rightAnchor, constant: 0.0),
124+
]
125+
}
126+
127+
func backdropAlpha(for state: FloatingPanelState) -> CGFloat {
128+
return state == .full ? 0.3 : 0.0
111129
}
112-
}
113-
114-
var supportedPositions: Set<FloatingPanelPosition> = [.full, .hidden]
115-
116-
func backdropAlphaFor(position: FloatingPanelPosition) -> CGFloat {
117-
return 0.3
118-
}
119130
}

widgets-datetime-picker/src/iosMain/swift/DateBottomSheetController.swift

Lines changed: 34 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import FloatingPanel
77

88
private var AssociatedDelegateHandle: UInt8 = 0
99

10-
@objc public class DateBottomSheetController: NSObject, FloatingPanelControllerDelegate {
10+
@objc public class DateBottomSheetController: NSObject {
1111

1212
private weak var controller: FloatingPanelController?
1313
private var onDismiss: ((Bool) -> Void)?
@@ -41,9 +41,8 @@ private var AssociatedDelegateHandle: UInt8 = 0
4141
fpc.backdropView.backgroundColor = UIColor.black
4242
fpc.isRemovalInteractionEnabled = true
4343
fpc.surfaceView.grabberHandle.isHidden = true
44-
fpc.surfaceView.grabberHandleHeight = 0
45-
fpc.surfaceView.grabberTopPadding = 0
46-
fpc.surfaceView.contentInsets = .zero
44+
fpc.surfaceView.grabberHandleSize.height = 0
45+
fpc.surfaceView.grabberHandlePadding = 0
4746

4847
controller = fpc
4948
self.onDismiss = onDismiss
@@ -68,12 +67,12 @@ class FloatingDelegate: FloatingPanelControllerDelegate {
6867
self.onDismiss = onDismiss
6968
}
7069

71-
func floatingPanel(_ vc: FloatingPanelController, layoutFor newCollection: UITraitCollection) -> FloatingPanelLayout? {
70+
func floatingPanel(_ vc: FloatingPanelController, layoutFor newCollection: UITraitCollection) -> FloatingPanelLayout {
7271
return floatingLayout
7372
}
7473

7574
func floatingPanelDidEndDecelerating(_ vc: FloatingPanelController) {
76-
if vc.position == .hidden {
75+
if vc.state == .hidden {
7776
vc.removePanelFromParent(animated: true)
7877
vc.dismiss(animated: false, completion: nil)
7978
onDismiss(false)
@@ -86,26 +85,34 @@ class FloatingDelegate: FloatingPanelControllerDelegate {
8685
}
8786

8887
class BottomSheetLayout: FloatingPanelLayout {
89-
var initialPosition: FloatingPanelPosition = .half
90-
91-
private let preferredHeight: CGFloat
92-
93-
init(preferredHeight: CGFloat) {
94-
self.preferredHeight = preferredHeight
95-
}
96-
97-
func insetFor(position: FloatingPanelPosition) -> CGFloat? {
98-
switch (position) {
99-
case .half: return preferredHeight
100-
case .full: return 0
101-
case .tip: return 0
102-
case .hidden: return 0
88+
private let preferredHeight: CGFloat
89+
90+
var position: FloatingPanelPosition {
91+
return .bottom
92+
}
93+
94+
var initialState: FloatingPanelState {
95+
return .half
96+
}
97+
98+
var anchors: [FloatingPanelState : FloatingPanelLayoutAnchoring] {
99+
return [
100+
.half: FloatingPanelLayoutAnchor(absoluteInset: preferredHeight, edge: .bottom, referenceGuide: .safeArea)
101+
]
102+
}
103+
104+
init(preferredHeight: CGFloat) {
105+
self.preferredHeight = preferredHeight
106+
}
107+
108+
func prepareLayout(surfaceView: UIView, in view: UIView) -> [NSLayoutConstraint] {
109+
return [
110+
surfaceView.leftAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leftAnchor, constant: 0.0),
111+
surfaceView.rightAnchor.constraint(equalTo: view.safeAreaLayoutGuide.rightAnchor, constant: 0.0),
112+
]
113+
}
114+
115+
func backdropAlpha(for state: FloatingPanelState) -> CGFloat {
116+
return 0.3
103117
}
104-
}
105-
106-
var supportedPositions: Set<FloatingPanelPosition> = [.half, .hidden]
107-
108-
func backdropAlphaFor(position: FloatingPanelPosition) -> CGFloat {
109-
return 0.3
110-
}
111118
}

widgets/src/iosMain/def/objcAddtition.def

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,7 @@ NSURLSessionDataTask* dataTask(NSURLSession* session, NSURL* url, void (^complet
3636
}
3737
];
3838
}
39+
40+
@protocol KeyValueObserver
41+
- (void)observeValueForKeyPath:(nullable NSString *)keyPath ofObject:(nullable id)object change:(nullable NSDictionary<NSKeyValueChangeKey, id> *)change context:(nullable void *)context;
42+
@end

0 commit comments

Comments
 (0)