swiftui drawer
Landscape
Un contrôleur ascendant Swiftui, comme dans l'application Maps. Faites glisser pour développer ou minimiser.
Fichier> Packages Swift> Ajouter une dépendance du package: https://github.com/maustinstar/swiftui-rawer
Ajoutez une dépendance dans votre Package.swift
. package ( url : " https://github.com/maustinstar/swiftui-drawer.git " , from : " 0.1.0 " ) , Incorporez votre contenu de vue dans un ZStack avec le tiroir comme dernier élément. Le paramètre heights définit une liste de hauteurs de repos pour le tiroir.
ZStack {
ScrollView {
//...
}
Drawer ( heights : [ 100 , 340 ] ) {
Color . blue
} . edgesIgnoringSafeArea ( . vertical )
}Voir le guide de référence complet.
Un tiroir multi-hauteur avec un impact haptique.
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 )Voir plus d'exemples
Faites passer vos applications Swiftui au niveau supérieur avec ces packages!