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
// | |
// ContentView.swift | |
// ToolTOPS | |
// | |
// Created by Damodar Namala on 02/02/22. | |
// | |
import SwiftUI | |
import Combine |
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 ContentView: View { | |
let keyboard: UIKeyboardType = .emailAddress | |
@State var text = "" | |
var body: some View { | |
Text("Hello, world!") | |
.padding() | |
TextField("Home", text: $text.limit(by: 10).trim(.numeric)) | |
.keyboardType(keyboard) |
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 Foundation | |
import SwiftUI | |
extension CharacterSet { | |
static let accountNumberSet = CharacterSet.letters.union(CharacterSet(charactersIn: " ")) | |
} | |
struct TitledInputField: View { | |
let title: String |
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
// | |
// ContentView.swift | |
// Amount | |
// | |
// Created by Damodar Namala on 25/02/22. | |
// | |
import SwiftUI | |
import Combine |
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
var sides: Sides = .east | |
struct ContentView: View { | |
@State var animate = false | |
var body: some View { | |
VStack { | |
Text("Hi") | |
}.onAppear { | |
sides.apply { side in | |
side = .north |
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
extension Sequence { | |
public func inspect(_ body: (Element) throws -> Void) rethrows -> Self { | |
for element in self { | |
try body(element) | |
} | |
return self | |
} | |
} | |
extension Sequence { |
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 ContentView: View { | |
var body: some View { | |
HStack { | |
Rectangle() | |
.frame(width: 200, height: 200, alignment: .center) | |
}.card() | |
} | |
} |
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
protocol Feature { | |
static func load() | |
} | |
class LoginFeature: Feature { | |
static func load() { | |
print("loging in with") | |
} | |
} |
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
typealias Effect<A> = (A) -> A | |
var effect: Effect<String> = { str in | |
return str | |
} | |
// Ussage: | |
print(effect("Damodar")) |
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 Country: Comparable, Identifiable { | |
static func < (lhs: Country, rhs: Country) -> Bool { | |
return lhs.name < rhs.name && lhs.code < rhs.code | |
} | |
var code: String | |
var name: String | |
var id = UUID() | |
} | |
let countries = [ |