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 | |
var sw = UIScreen.main.bounds.width | |
struct ContentView: View { | |
@State var drive:Bool = true | |
var body: some View { | |
ZStack{ |
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 StopWatchManeger:ObservableObject{ | |
enum stopWatchMode{ | |
case start | |
case stop | |
case pause | |
} | |
@Published var mode:stopWatchMode = .stop | |
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 | |
class StopWatchManeger:ObservableObject{ | |
@Published var secondsElapsed = 0.0 | |
var timer = Timer() | |
func start(){ | |
timer = Timer.scheduledTimer(withTimeInterval: 0.1, repeats: true){ timer in | |
self.secondsElapsed += 0.1 | |
} |
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
// | |
// ContentView.swift | |
// coredataTest | |
// | |
// Created by ns on 2020/01/25. | |
// Copyright © 2020 ns. All rights reserved. | |
// | |
import SwiftUI | |
import CoreData |
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 | |
class CalcViewModel:ObservableObject{ | |
@Published var display = "0" | |
@Published var middleTyping = false | |
var displayValue:Double{ | |
get{ | |
return Double(display)! | |
} |
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 var display = "0" | |
var body: some View { | |
VStack(spacing:10){ | |
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 var display = 0 | |
@State var currentValue = 0 | |
@State var useIsInTheMiddleOfTyping = false | |
@State var first = 0 | |
@State var second = 0 | |
@State var operand = "+" |
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 var inputText:String = "" | |
@State var display:String = "0" | |
@State var currentValue = "" | |
@State var useIsInTheMiddleOfTyping = false | |
@State var first = "" | |
@State var operand = "" |
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 | |
struct CalcBrain{ | |
// private var accumulator:Double? | |
// | |
// private enum Operation{ | |
// case constant(Double) | |
//// case unryOperation((Double) -> Double) | |
// case binaryOperation((Double,Double)->Double) |
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 CaluculatorBrain { | |
private var accumulator:Double? | |
mutating func performOperation(_ symbol:String){ | |
switch symbol { | |
case "π": | |
accumulator = Double.pi | |
case "√": | |
if let operand = accumulator{ | |
accumulator = sqrt(operand) |
NewerOlder