Skip to content

Commit

Permalink
Merge pull request #1098 from adevinta/demo-snackbar-uiview
Browse files Browse the repository at this point in the history
[Demo] Added Snackbar demo
  • Loading branch information
LouisBorleeAdevinta authored Oct 7, 2024
2 parents ac06b31 + 751d81a commit cfe246e
Show file tree
Hide file tree
Showing 55 changed files with 995 additions and 2,184 deletions.
5 changes: 5 additions & 0 deletions .Demo/App/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
//

import UIKit
import SwiftUI
import SparkSnackbar
import SparkButton
import SparkTheming

class SceneDelegate: UIResponder, UIWindowSceneDelegate {

Expand All @@ -16,6 +20,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
guard let windowScene = scene as? UIWindowScene else { return }

let window = UIWindow(windowScene: windowScene)
SparkConfiguration.load()
window.rootViewController = SparkTabbarController()
self.window = window
window.makeKeyAndVisible()
Expand Down
13 changes: 13 additions & 0 deletions .Demo/Classes/Enum/Components.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// Components.swift
// SparkDemo
//
// Created by louis.borlee on 19/09/2024.
// Copyright © 2024 Adevinta. All rights reserved.
//

import Foundation

enum Components: CaseIterable {
case snackbar
}
18 changes: 8 additions & 10 deletions .Demo/Classes/Tabbar/SparkTabbarController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,16 @@ public final class SparkTabbarController: UITabBarController {
}()

/// Third Tab
private lazy var listViewController: UIViewController = {
let layout = ComponentsViewController.makeLayout()
let viewController = UINavigationController(rootViewController: ListComponentsViewController(collectionViewLayout: layout))
viewController.tabBarItem = UITabBarItem(title: "List", image: UIImage(systemName: "list.bullet.rectangle"), tag: 0)
private lazy var uiKitViewController: UIViewController = {
let viewController = UIHostingController(rootView: NewComponentsView(isUIKit: true))
viewController.tabBarItem = UITabBarItem(title: "UIKit", image: UIImage(systemName: "u.circle"), tag: 0)
return viewController
}()

/// Fourth Tab
private lazy var settingsViewController: UIViewController = {
var layout = SettingsViewController.makeLayout()
let viewController = UINavigationController(rootViewController: SettingsViewController(collectionViewLayout: layout))
viewController.tabBarItem = UITabBarItem(title: "Settings", image: UIImage(systemName: "gear"), tag: 0)
private lazy var swiftUIViewController: UIViewController = {
let viewController = UIHostingController(rootView: NewComponentsView(isUIKit: false))
viewController.tabBarItem = UITabBarItem(title: "SwiftUI", image: UIImage(systemName: "s.circle"), tag: 0)
return viewController
}()

Expand All @@ -67,8 +65,8 @@ public final class SparkTabbarController: UITabBarController {
viewControllers = [
self.themeViewController,
self.componentVersionViewController,
self.listViewController,
self.settingsViewController
self.uiKitViewController,
self.swiftUIViewController
]
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
//
// OptionalEnumSelector.swift
// SparkDemo
//
// Created by louis.borlee on 19/09/2024.
// Copyright © 2024 Adevinta. All rights reserved.
//

import SwiftUI

struct OptionalEnumSelector<Value>: View where Value: CaseIterable & Hashable {
let title: String
let dialogTitle: String
let values: [Value]
@Binding var value: Value?

var nameFormatter: (Value?) -> String = { value in
return value?.name ?? "Default"
}

@State private var isPresented = false

var body: some View {
HStack() {
Text("\(title): ").bold()
Button(self.nameFormatter(value)) {
self.isPresented = true
}
.confirmationDialog(dialogTitle, isPresented: self.$isPresented) {
ForEach(self.values, id: \.self) { value in
Button(self.nameFormatter(value)) {
self.value = value
}
}
Button("Default") {
self.value = nil
}
}
}
}
}
43 changes: 0 additions & 43 deletions .Demo/Classes/View/ListView/Cells/BadgeCell/BadgeCell.swift

This file was deleted.

This file was deleted.

77 changes: 0 additions & 77 deletions .Demo/Classes/View/ListView/Cells/ButtonCell/ButtonCell.swift

This file was deleted.

This file was deleted.

55 changes: 0 additions & 55 deletions .Demo/Classes/View/ListView/Cells/CheckboxCell/CheckboxCell.swift

This file was deleted.

This file was deleted.

Loading

0 comments on commit cfe246e

Please sign in to comment.