swiftui drawer
Landscape
SwiftUI自下而上的控制器,例如MAPS应用程序。拖动以扩展或最小化。
文件> swift packages>添加软件包依赖关系:https://github.com/maustinstar/swiftui-drawer
在您的Package.swift中添加依赖性。
. package ( url : " https://github.com/maustinstar/swiftui-drawer.git " , from : " 0.1.0 " ) , 将您的视图内容嵌入ZStack中,将抽屉作为最后一个元素。 heights参数定义了抽屉的静息高度列表。
ZStack {
ScrollView {
//...
}
Drawer ( heights : [ 100 , 340 ] ) {
Color . blue
} . edgesIgnoringSafeArea ( . vertical )
}请参阅完整的参考指南。
具有触觉影响的多高度抽屉。
Drawer {
ZStack {
RoundedRectangle ( cornerRadius : 12 )
. foregroundColor ( . white )
. shadow ( radius : 100 )
VStack ( alignment : . center ) {
Spacer ( ) . frame ( height : 4.0 )
RoundedRectangle ( cornerRadius : 3.0 )
. foregroundColor ( . gray )
. frame ( width : 30.0 , height : 6.0 )
Spacer ( )
}
}
} . edgesIgnoringSafeArea ( . vertical )
. rest ( at : . constant ( [ 100 , 340 , UIScreen . main . bounds . height - 40 ] ) )
. impact ( . light )查看更多示例
使用这些软件包将您的SwiftUi应用程序提升到一个新的水平!