Xcode 12 — iOS14

1. Any text in ^{} will be treated as superscript.
e.g. => X^{2} -> X²
2. Any text in _{} will be treated as subscript.
e.g. => H_{2} => H₂
var text = Text("pre") + Text("post")//Also
text = text + Text("more text")
Text("X").font(.callout) + Text(2).font(.caption).baselineOffset(6.0)Output => X²

Logic to implement:

1. Iterate throw String for find…


SwiftUI: Fixing keyboard issues, while creating forms [iOS 14- XCode 12]

  1. Wrap UIKit’s UITextField using UIViewRepresentable
  2. Enable this new TextField to pass keyboard using cross binding
  3. Add Toolbar for numeric keyboard as they do not have next button inbuild
  4. Use Introspect to enable interactive keyboard dismissal.

UIKit’s UITextField using UIViewRepresentable:


  1. Create Simple List View with or without header.
  2. Create Custom Action Buttons.
  3. Create a view modifier. This view modifier will be used to listen swipe gesture
  4. On swipe direction, show/hide relevant buttons
  5. Add View extension utility so that we can easily use view modifier.

Simple List View:


import SwiftUI
import Introspect //To Get UIView in view hierarchy
@main
struct
LoopingVideoApp: App {
var body: some Scene {…


Flow chart for various app architecture


Xcode 12 — iOS 14

  1. Create an extension on SwiftUI’s view, which takes the position of part of the view we need to convert into an image. We will create a dummy UIHostingViewController with the given frame. From UIHostingView controller, we will access UIKit’s view.
extension View {    
func takeScreenshot(origin: CGPoint, size: CGSize) -> UIImage {…


Source: Bloomberg


Various methods to store/read data in iOS App

Bundle

//Access the main bundlelet bundle = Bundle.main
let jsonFile = Bundle.main.path(forResource: “xxx”, ofType: “json”)

Sandbox


Multiline Text field Xocde 12 — iOS 14 [iOS 13 support here]

struct CustomTextEditor: View {
let placeholder: String
@Binding var


Pull down to refresh data in SwiftUI — Xcode 12-iOS 14

  1. Logic to detect if user pull down the scroll view
  2. Add Progress view and pull down loader animations

Prafulla Singh

iOS Developer | Swift | Flutter

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store