Cleanup demo app

This commit is contained in:
Daniel Saidi 2021-11-20 10:16:14 +01:00
parent 96b7b3de6a
commit ee4e321e40
6 changed files with 5 additions and 82 deletions

View File

@ -81,8 +81,6 @@
A98278B7257E7AC20006D64F /* NetworkScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = A98278B5257E7AC20006D64F /* NetworkScreen.swift */; };
A98278BC257E7B3D0006D64F /* ServicesScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = A98278BB257E7B3D0006D64F /* ServicesScreen.swift */; };
A98278BD257E7B3D0006D64F /* ServicesScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = A98278BB257E7B3D0006D64F /* ServicesScreen.swift */; };
A98278C3257E7C290006D64F /* DemoAppearance.swift in Sources */ = {isa = PBXBuildFile; fileRef = A98278C2257E7C290006D64F /* DemoAppearance.swift */; };
A98278C4257E7C290006D64F /* DemoAppearance.swift in Sources */ = {isa = PBXBuildFile; fileRef = A98278C2257E7C290006D64F /* DemoAppearance.swift */; };
A98278D3257E83250006D64F /* Color+Demo.swift in Sources */ = {isa = PBXBuildFile; fileRef = A98278D2257E83250006D64F /* Color+Demo.swift */; };
A98278D4257E83250006D64F /* Color+Demo.swift in Sources */ = {isa = PBXBuildFile; fileRef = A98278D2257E83250006D64F /* Color+Demo.swift */; };
/* End PBXBuildFile section */
@ -137,7 +135,6 @@
A98278AE257E76A50006D64F /* sv */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = sv; path = sv.lproj/Localizable.strings; sourceTree = "<group>"; };
A98278B5257E7AC20006D64F /* NetworkScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkScreen.swift; sourceTree = "<group>"; };
A98278BB257E7B3D0006D64F /* ServicesScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ServicesScreen.swift; sourceTree = "<group>"; };
A98278C2257E7C290006D64F /* DemoAppearance.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DemoAppearance.swift; sourceTree = "<group>"; };
A98278D2257E83250006D64F /* Color+Demo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Color+Demo.swift"; sourceTree = "<group>"; };
/* End PBXFileReference section */
@ -183,9 +180,9 @@
A9544BBD2571CBC800522141 = {
isa = PBXGroup;
children = (
A9544BC22571CBC800522141 /* Shared */,
A9544BCC2571CBC900522141 /* iOS */,
A9544BD32571CBC900522141 /* macOS */,
A9544BC22571CBC800522141 /* Shared */,
A9544BCB2571CBC900522141 /* Products */,
A9544BEA2571CC3200522141 /* Project Files */,
A9544D56257455DA00522141 /* Frameworks */,
@ -260,7 +257,6 @@
children = (
A9544BC42571CBC800522141 /* ContentView.swift */,
A9544BC32571CBC800522141 /* DemoApp.swift */,
A98278C2257E7C290006D64F /* DemoAppearance.swift */,
);
path = Demo;
sourceTree = "<group>";
@ -548,7 +544,6 @@
A9544D42257444DE00522141 /* BiometricAuthenticationServiceScreen.swift in Sources */,
A9544BD82571CBC900522141 /* ContentView.swift in Sources */,
A90CD6B3257E2E6E008A1749 /* DeviceScreen.swift in Sources */,
A98278C3257E7C290006D64F /* DemoAppearance.swift in Sources */,
A9827840257E550B0006D64F /* DirectoryServiceScreen.swift in Sources */,
A90CD6B7257E3343008A1749 /* DeviceIdentifierScreen.swift in Sources */,
A98278BC257E7B3D0006D64F /* ServicesScreen.swift in Sources */,
@ -583,7 +578,6 @@
A9544BD92571CBC900522141 /* ContentView.swift in Sources */,
A982786B257E5D550006D64F /* GeoScreen.swift in Sources */,
A982788D257E67660006D64F /* KeychainServiceScreen.swift in Sources */,
A98278C4257E7C290006D64F /* DemoAppearance.swift in Sources */,
A98278D4257E83250006D64F /* Color+Demo.swift in Sources */,
A982781E257E52680006D64F /* ExtensionsScreen.swift in Sources */,
A982787D257E65850006D64F /* IoCScreen.swift in Sources */,

View File

@ -14,13 +14,12 @@ struct ContentView: View {
var body: some View {
NavigationView {
List {
Section {
Section(header: Text("Sections")) {
list1
list2
}
}
.navigationTitle("SwiftKit")
.withPlatformSpecificNavigationMode()
}.withPlatformSpecificNavigationStyle()
}
}
@ -78,21 +77,12 @@ private extension ContentView {
private extension View {
func withPlatformSpecificNavigationMode() -> some View {
#if os(iOS)
return self
.navigationBarTitleDisplayMode(.inline)
#else
return self
#endif
}
func withPlatformSpecificNavigationStyle() -> some View {
#if os(iOS)
#if os(iOS)
return self.navigationViewStyle(StackNavigationViewStyle())
#else
#else
return self
#endif
#endif
}
}

View File

@ -11,10 +11,6 @@ import SwiftUI
@main
struct DemoApp: App {
init() {
DemoAppearance.apply()
}
var body: some Scene {
WindowGroup {
ContentView()

View File

@ -1,55 +0,0 @@
//
// DemoAppearance.swift
// Demo
//
// Created by Daniel Saidi on 2020-12-07.
// Copyright © 2020 Daniel Saidi. All rights reserved.
//
import Foundation
import SwiftUIKit
#if os(iOS)
import UIKit
#endif
final class DemoAppearance {
private init() {}
static func apply() {
#if os(iOS)
if #available(iOS 13.0, *) {
let navbar = UINavigationBar.appearance()
let navbarAppearance = UINavigationBarAppearance()
navbarAppearance.configureWithOpaqueBackground()
navbarAppearance.backgroundColor = .accent
navbarAppearance.titleTextAttributes = titleAttributes
navbarAppearance.largeTitleTextAttributes = largeTitleAttributes
navbar.tintColor = .white
navbar.standardAppearance = navbarAppearance
navbar.scrollEdgeAppearance = navbarAppearance
}
#endif
}
}
#if os(iOS)
private extension DemoAppearance {
static var titleAttributes: [NSAttributedString.Key: Any] {
[.font: UIFont.systemFont(ofSize: 20, weight: .light), .foregroundColor: UIColor.white, .shadow: shadow]
}
static var largeTitleAttributes: [NSAttributedString.Key: Any] {
[.font: UIFont.systemFont(ofSize: 40, weight: .thin), .foregroundColor: UIColor.white, .shadow: shadow]
}
static var shadow: NSShadow {
let shadow = NSShadow()
shadow.shadowBlurRadius = 5
shadow.shadowColor = UIColor.clear
return shadow
}
}
#endif

View File

@ -35,8 +35,6 @@
<array>
<string>armv7</string>
</array>
<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleLightContent</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>