Skip to content

Commit

Permalink
[IRP-1015] SPM migration
Browse files Browse the repository at this point in the history
  • Loading branch information
robergro committed Jun 27, 2024
1 parent f94b77d commit c1fa184
Show file tree
Hide file tree
Showing 1,209 changed files with 610 additions and 71,763 deletions.
2 changes: 2 additions & 0 deletions spark/Demo/AppDelegate.swift → .Demo/App/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
//

import UIKit
@_exported import SparkCore
@_exported import SparkCoreTesting

/// Appdelegate was added for starting app with a viewcontroller. So It help us to integrate UIkit components to UIViewController class diretly. SwiftUI components are working on UIHostingController class more stablize than UIkit components that was integrated with a UIViewRepresentable class.
@main
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

import UIKit

// swiftlint:disable all

class SceneDelegate: UIResponder, UIWindowSceneDelegate {

var window: UIWindow?
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2023 Adevinta. All rights reserved.
//

import Spark
@_spi(SI_SPI) import SparkCommon
import SwiftUI
import SparkCore

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import Combine
import Foundation
import UIKit
@_spi(SI_SPI) import SparkCommon

final class Console {
static var publisher: some Publisher<String, Never> {
Expand All @@ -20,7 +21,7 @@ final class Console {
}
}

final class ConsoleView: UIView {
public final class ConsoleView: UIView {

enum Constants {
static let fullWidth: CGFloat = 200
Expand All @@ -29,7 +30,7 @@ final class ConsoleView: UIView {

private var dataSource = [String]()

static let shared = ConsoleView()
public static let shared = ConsoleView()

private var width: CGFloat {
return self.consoleButton.isSelected ? Constants.fullWidth : Constants.collapsedWidth
Expand Down Expand Up @@ -87,7 +88,7 @@ final class ConsoleView: UIView {
fatalError("init(coder:) has not been implemented")
}

func show() {
public func show() {
guard let window = UIApplication.shared.windows.last else {
return
}
Expand Down Expand Up @@ -178,18 +179,18 @@ final class ConsoleView: UIView {
}

extension ConsoleView: UITableViewDelegate {
func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat {
public func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat {
return 12.0
}
}

extension ConsoleView: UITableViewDataSource {

func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return section == 0 ? self.dataSource.count : 0
}

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
guard let cell = self.tableView.dequeueReusableCell(withIdentifier: ConsoleTableViewCell.cellIdentifier) as? ConsoleTableViewCell else {
fatalError("Couldn't dequeue table view cell")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@

import UIKit
import SwiftUI
import Spark
import SparkCore
import Combine

final class SparkTabbarController: UITabBarController {
public final class SparkTabbarController: UITabBarController {

// MARK: - Published Properties
@ObservedObject private var themePublisher = SparkThemePublisher.shared
Expand Down Expand Up @@ -52,7 +51,7 @@ final class SparkTabbarController: UITabBarController {
}()

// MARK: - ViewDidLoad
override func viewDidLoad() {
public override func viewDidLoad() {
super.viewDidLoad()

self.loadSparkConfiguration()
Expand All @@ -77,9 +76,9 @@ final class SparkTabbarController: UITabBarController {
self.themePublisher
.$theme
.eraseToAnyPublisher()
.sink(receiveValue: { theme in
self.tabBar.tintColor = theme.colors.main.main.uiColor
})
.store(in: &cancellables)
.sink { theme in
self.tabBar.tintColor = theme.colors.main.main.uiColor
}
.store(in: &cancellables)
}
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import Foundation
import SparkCore
import Spark

public class SparkThemePublisher: ObservableObject {
public static let shared = SparkThemePublisher()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2023 Adevinta. All rights reserved.
//

import Spark
@_spi(SI_SPI) import SparkCommon
import SparkCore
import SwiftUI

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2023 Adevinta. All rights reserved.
//

import Spark
@_spi(SI_SPI) import SparkCommon
import SparkCore
import SwiftUI

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import UIKit
import Combine
import SparkCore
import Spark
@_spi(SI_SPI) import SparkCommon

final class BadgeComponentUIView: UIView {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//

import Combine
import Spark
@_spi(SI_SPI) import SparkCommon
import SparkCore
import UIKit

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
//

import Combine
import Spark
import SwiftUI
import UIKit
import SparkCore
@_spi(SI_SPI) import SparkCommon

final class BadgeComponentViewController: UIViewController {

Expand Down Expand Up @@ -51,11 +51,11 @@ final class BadgeComponentViewController: UIViewController {

themePublisher
.$theme
.sink(receiveValue: { [weak self] theme in
.sink { [weak self] theme in
guard let self = self else { return }
self.viewModel.theme = theme
self.navigationController?.navigationBar.tintColor = theme.colors.main.main.uiColor
})
}
.store(in: &self.cancellables)

self.viewModel.showThemeSheet.subscribe(in: &self.cancellables) { intents in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import SwiftUI

struct BottomSheetPresentedView: View {
var description: String = """
Sample of a SwiftUI bottom sheet with little text.
🧡💙
"""
Sample of a SwiftUI bottom sheet with little text.
🧡💙
"""
var dismiss: () -> Void

var body: some View {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,70 +9,70 @@
import SwiftUI

private let longDescription: String = """
Sample of a SwiftUI bottom sheet with a scroll view.
🧡
💙
🧡
💙
🧡
💙
🧡
💙
🧡
💙
🧡
💙
🧡
💙
🧡
💙
🧡
💙
🧡
💙
🧡
💙
🧡
💙
🧡
💙
🧡
💙
🧡
💙
🧡
💙
🧡
💙
🧡
💙
"""
Sample of a SwiftUI bottom sheet with a scroll view.
🧡
💙
🧡
💙
🧡
💙
🧡
💙
🧡
💙
🧡
💙
🧡
💙
🧡
💙
🧡
💙
🧡
💙
🧡
💙
🧡
💙
🧡
💙
🧡
💙
🧡
💙
🧡
💙
🧡
💙
🧡
💙
"""
private let mediumDescription: String = """
Sample of a SwiftUI bottom sheet with a long text.
🧡
💙
🧡
💙
🧡
💙
🧡
💙
🧡
💙
🧡
💙
🧡
💙
🧡
💙
🧡
💙
🧡
💙
🧡
💙
🧡
"""
Sample of a SwiftUI bottom sheet with a long text.
🧡
💙
🧡
💙
🧡
💙
🧡
💙
🧡
💙
🧡
💙
🧡
💙
🧡
💙
🧡
💙
🧡
💙
🧡
💙
🧡
"""
struct BottomSheetPresentingView: View {
var body: some View {
if #available(iOS 16.4, *) {
Expand Down Expand Up @@ -121,12 +121,12 @@ struct BottomSheetPresentingViewWithHeightDetent: View {
self.showingLongSheet.toggle()
}
.sheet(isPresented: $showingLongSheet) {
ScrollView {
BottomSheetPresentedView(description: longDescription) {
self.showingLongSheet.toggle()
}
ScrollView {
BottomSheetPresentedView(description: longDescription) {
self.showingLongSheet.toggle()
}
.scrollIndicators(.visible)
}
.scrollIndicators(.visible)
.presentationDetents([.medium, .large])
}
.buttonStyle(.borderedProminent)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//

import SwiftUI
import Spark
@_spi(SI_SPI) import SparkCommon
import SparkCore

struct ButtonComponentView: View {
Expand Down Expand Up @@ -194,7 +194,6 @@ private extension ButtonView {
case .highlighted: image = Image("close")
case .disabled: image = Image("check")
case .selected: image = Image("alert")
@unknown default: break
}
}

Expand All @@ -221,7 +220,6 @@ private extension ButtonView {
case .highlighted: title = "My Highlighted"
case .disabled: title = "My Disabled"
case .selected: title = "My Selected"
@unknown default: break
}

if content.containsAttributedText, let title {
Expand Down
Loading

0 comments on commit c1fa184

Please sign in to comment.