This file contains 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
// | |
// ViewController.swift | |
// TextField | |
// | |
// Created by Prafulla Singh on 11/5/22. | |
// | |
import UIKit | |
class ViewController: UIViewController { | |
lazy var secretBaseView: UIView? = { |
This file contains 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 | |
//Rule: | |
//_{} subscript | |
//^{} superscript | |
//mainFont | |
//script font | |
// | |
struct SubSuperScriptText: View { | |
let inputString: String |
This file contains 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 FormTextField: UIViewRepresentable { | |
let placeholder: String | |
@Binding var text: String | |
var returnKeyType: UIReturnKeyType = .next | |
var autocapitalizationType: UITextAutocapitalizationType = .none | |
var keyboardType: UIKeyboardType = .default | |
var tag: Int | |
func makeUIView(context: Context) -> UITextField { | |
let textField = UITextField(frame: .zero) | |
textField.delegate = context.coordinator |
This file contains 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
//Allow to move next text field on Next Tap | |
//Adds next in toolbar if keypad is number pad | |
//Allow interactive keyboard dismiss | |
import SwiftUI | |
import Introspect | |
@main | |
struct DemoFormKeyboardIssueFix: App { | |
@State var name: String = "" | |
@State var profession: String = "" |
This file contains 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
extension View { | |
func addButtonActions(leadingButtons: [CellButtons], trailingButton: [CellButtons], onClick: @escaping (CellButtons) -> Void) -> some View { | |
self.modifier(SwipeContainerCell(leadingButtons: leadingButtons, trailingButton: trailingButton, onClick: onClick)) | |
} | |
} |
This file contains 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 SwipeContainerCell: ViewModifier { | |
enum VisibleButton { | |
case none | |
case left | |
case right | |
} | |
@State private var offset: CGFloat = 0 | |
@State private var oldOffset: CGFloat = 0 |
This file contains 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 ContentView: View { | |
var body: some View { | |
NavigationView { | |
ScrollView { | |
LazyVStack.init(spacing: 0, pinnedViews: [.sectionHeaders], content: { | |
Section.init(header: | |
HStack { | |
Text("Section 1") | |
Spacer() |
This file contains 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 | |
let buttonWidth: CGFloat = 60 | |
enum CellButtons: Identifiable { | |
case edit | |
case delete | |
case save | |
case info | |
This file contains 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 | |
import Introspect | |
@main | |
struct DemoApp: App { | |
let tabBarControllerDelegate = TabBarControllerDelegate() | |
var body: some Scene { | |
WindowGroup { | |
TabView { | |
NavigationView { |
NewerOlder