This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
struct TabBarDemo: View { | |
@StateObject var tabItems = TabItems() | |
var body: some View { | |
ZStack { | |
///View1 | |
NavigationView { | |
ZStack { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Bar: Shape { | |
@ObservedObject var tabItems: TabItems | |
var tab: CGFloat | |
let firstCenter: CGFloat | |
let stepperToNextCenter: CGFloat | |
init(tabItems: TabItems, firstCenter: CGFloat, stepperToNextCenter: CGFloat) { | |
self.tabItems = tabItems | |
self.tab = tabItems.selectedTabIndex | |
self.firstCenter = firstCenter |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct TabBar: View { | |
@ObservedObject var tabItems: TabItems | |
let padding: CGFloat = 5 | |
let iconeSize: CGFloat = 20 | |
var iconFrame: CGFloat { | |
(padding * 2) + iconeSize | |
} | |
var tabItemCount: CGFloat { | |
CGFloat(tabItems.items.count) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
struct CardContent: View { | |
public var body: some View { | |
ZStack { | |
Color.gray | |
Text("Main View") | |
SlideOverView { | |
VStack { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
struct ChatUI : View { | |
@StateObject private var keyboard = KeyboardResponder() | |
var scrollToid = 99 | |
func Scroll(reader :ScrollViewProxy) -> some View { | |
DispatchQueue.main.asyncAfter(deadline: .now() + 0.05) { | |
withAnimation { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//https://stackoverflow.com/questions/56491881/move-textfield-up-when-the-keyboard-has-appeared-in-swiftui | |
import SwiftUI | |
final class KeyboardResponder: ObservableObject { | |
private var notificationCenter: NotificationCenter | |
@Published private(set) var currentHeight: CGFloat = 0 | |
init(center: NotificationCenter = .default) { | |
notificationCenter = center | |
notificationCenter.addObserver(self, selector: #selector(keyBoardWillShow(notification:)), name: UIResponder.keyboardWillShowNotification, object: nil) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct ChatUI : View { | |
@State private var fullText: String = "" | |
var body: some View { | |
ZStack { | |
ScrollView(.vertical, showsIndicators: false) { } | |
VStack { | |
Spacer() | |
HStack { | |
Button(action: { |