Skip to content
Snippets Groups Projects
Commit c84b2226 authored by hannes's avatar hannes
Browse files

Revert "no changes but xcode thinks so"

This reverts commit a75817dd, reversing
changes made to de8e330c.
parent a75817dd
Branches
Tags
2 merge requests!59Onboarding screens swift ui merge dev,!58Onboarding screens swift ui merge dev
//
// GeometryGetter.swift
// enzevalos_iphone
//
// Created by melicoa97 on 05.03.20.
// Copyright © 2020 fu-berlin. All rights reserved.
//
import SwiftUI
struct GeometryGetter: View {
@Binding var rect: CGRect
var body: some View {
GeometryReader { geometry in
Group { () -> AnyView in
DispatchQueue.main.async {
self.rect = geometry.frame(in: .global)
}
return AnyView(Color.clear)
}
}
}
}
//
// KeyboardChecker.swift
// enzevalos_iphone
//
// Created by hanneh00 on 17.03.20.
// Copyright © 2020 fu-berlin. All rights reserved.
//
//-------------------this file should be moved to the reusable swiftUI views-----------------
import SwiftUI
final class KeyboardResponder: ObservableObject {
private var notificationCenter: NotificationCenter
@Published private(set) var currentHeight: CGFloat = 0
init(center: NotificationCenter = .default) {
notificationCenter = center
notificationCenter.addObserver(self, selector: #selector(keyBoardWillShow(notification:)), name: UIResponder.keyboardWillShowNotification, object: nil)
notificationCenter.addObserver(self, selector: #selector(keyBoardWillHide(notification:)), name: UIResponder.keyboardWillHideNotification, object: nil)
}
deinit {
notificationCenter.removeObserver(self)
}
@objc func keyBoardWillShow(notification: Notification) {
if let keyboardSize = (notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue {
currentHeight = keyboardSize.height
}
}
@objc func keyBoardWillHide(notification: Notification) {
currentHeight = 0
}
}
//
// OnboardingIntroInfosection.swift
// enzevalos_iphone
//
// Created by melicoa97 on 03.03.20.
// Copyright © 2020 fu-berlin. All rights reserved.
//
import SwiftUI
struct OnboardingIntroInfosection: View {
var sections:[OnboardingIntroInfoSubsection] = [
OnboardingIntroInfoSubsection(
headline:NSLocalizedString("OnboardingIntroSection.Confidential.headline", comment: ""),
previewText:NSLocalizedString("OnboardingIntroSection.Confidential.preview", comment: ""),
description:NSLocalizedString("OnboardingIntroSection.Confidential.description", comment: ""),
image: StudySettings.securityIndicator.imageOfSecureIndicatorSwiftUI(background: false, open: false, button: false)),
OnboardingIntroInfoSubsection(
headline:NSLocalizedString("OnboardingIntroSection.Detection.headline", comment: ""),
previewText:NSLocalizedString("OnboardingIntroSection.Detection.preview", comment: ""),
description:NSLocalizedString("OnboardingIntroSection.Detection.description", comment: ""),
image: StudySettings.securityIndicator.imageOfInsecureIndicatorSwiftUI(background: false, button: false))
]
var body: some View {
VStack(alignment: .leading){
ForEach(sections,id: \.id){section in
OnboardingIntroInfosubsection(image: section.image, headline: section.headline, previewText: section.previewText, description: section.description).padding(.vertical, 10)
}
}
.padding(.horizontal, 40)
}
}
struct OnboardingIntroInfosubsection: View {
var image:Image
var headline:String
var previewText:String
var description:String
@State private var pressed:Bool=true
var body: some View {
Button(action: {
self.pressed.toggle()
}){
HStack(alignment: .top){
image
.renderingMode(Image.TemplateRenderingMode?.init(Image.TemplateRenderingMode.original))
.resizable()
.frame(width: 49, height:37)
VStack(alignment: .leading){
Text(headline).font(.body).fontWeight(.bold)
if(pressed){
Text(previewText).fontWeight(.thin).font(.subheadline)
}else {
Text(description)
.fontWeight(.thin)
.font(.subheadline)
}
}.padding(.leading, 20)
Spacer()
}
}
.foregroundColor(.primary)
}
}
class OnboardingIntroInfoSubsection{
var image:Image
var headline:String
var previewText:String
var description:String
var id:UUID
init(headline:String, previewText:String, description:String, image:Image){
self.id = UUID()
self.headline = headline
self.previewText = previewText
self.description = description
self.image = image
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment