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 ContentView: View { | |
@State private var username: String = "" | |
@State private var password: String = "" | |
var body: some View { | |
VStack { | |
Spacer(minLength: 20) | |
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 LoginView: View { | |
@State private var username = "" | |
@State private var password = "" | |
var body: some View { | |
VStack { | |
Image("logo") | |
.resizable() |
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 LoginPage: View { | |
@State private var username: String = "" | |
@State private var password: String = "" | |
var body: some View { | |
VStack { | |
Image("your_image_name_here") | |
.resizable() | |
.frame(width: 300, height: 300) | |
.padding(.top, 20) |
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 Auth0 | |
struct LoginView: View { | |
@State private var email = "" | |
@State private var password = "" | |
@State private var profile: UserInfo? | |
var body: some View { | |
VStack { |
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
class Subject { | |
var list: [Adventurer] = [] | |
func add(adventurer: Adventurer) { | |
list.append(adventurer) | |
} | |
func remove(adventurer: Adventurer) { | |
if let index = list.firstIndex(where: { $0 == adventurer}) { | |
list.remove(at: index) | |
} |
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
class DataModel: NSObject { | |
var data = 1 | |
var callback: ((Any?) -> Unmanaged<AnyObject>?)? | |
} | |
class CustomClass: NSObject { | |
@objc func getValue(_ model: DataModel, completion callback: Any!) { | |
print("get Value for CustomClass") |
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 Foundation | |
class CustomClass: NSObject { | |
@objc func getValue(_ arg: Int) { | |
print("val is: 100") | |
} | |
@objc func getValue2() { | |
print("val is: 2") | |
} |
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
class DisposeBag { | |
var delegate: RxSimulator? | |
deinit { | |
print("test11 DisposeBag deinit") | |
delegate = nil | |
} | |
} | |
class RxSimulator { |
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
// Ref: https://stackoverflow.com/questions/24245262/call-a-method-from-a-string-in-swift | |
import UIKit | |
class TestDevice1: NSObject { | |
@objc func getPressure() { | |
print("get Pressure for TestDevice1") | |
} | |
@objc func getBattery() { | |
print("get Battery for TestDevice1") |
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
// Ref: | |
// https://gist.github.com/algal/54467df650c875827f2b | |
// https://developer.apple.com/documentation/dispatch/dispatchio/2892309-init | |
class FileOutputStream: OutputStream { | |
private var filepath: URL! | |
private var channel: DispatchIO! | |
// Initialized an output stream that writes to `filepath`. |