|
- import BusX
- import Combine
- import MeetupIdX
- import MicX
- import SwiftUI
- import UIKit
-
- struct Content: View {
- @State private var selectedId = "1"
- var ids = ["1", "2", "3", "4"]
- var body: some View {
- VStack {
- HStack {
- Text("MicItem id:")
- Picker("", selection: $selectedId) {
- ForEach(ids, id: \.self) {
- Text($0)
- }
- }
- }
- .pickerStyle(.segmented)
- Divider()
- .padding()
- MicItem.V(selectedId)
- Divider()
- .padding()
- List {
- ForEach(ids, id: \.self) {
- Text("\($0): TODO state")
- }
- }
- }
- .padding()
- }
- }
-
- @UIApplicationMain
- class AppDelegate: UIResponder, UIApplicationDelegate
- {
- let meetupIS = MeetupId.Service(.init())
- let micS = Mic.Service(.init())
- var window: UIWindow?
-
- func application(
- _ application: UIApplication,
- didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
- ) -> Bool {
- window = UIWindow(frame: UIScreen.main.bounds)
- let vc = UIViewController()
- addSwiftUIViewAsChild(swiftUIView: Content(), parent: vc.view)
- vc.view.backgroundColor = .white
- window?.rootViewController = vc
- window?.backgroundColor = UIColor.white
- window?.makeKeyAndVisible()
-
- print("ИГР App.didFLWO")
-
-
-
-
-
- testMic4()
- return true
- }
-
- func testMic1() {
- DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
- Bus.send(Mic.K.isActive, true)
- }
- DispatchQueue.main.asyncAfter(deadline: .now() + 4) {
- Bus.send(Mic.K.isActive, false)
- }
- }
-
- func testMic2() {
- DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
- Bus.send(Mic.K.activityDate, Date() + 2)
- }
-
- DispatchQueue.main.asyncAfter(deadline: .now() + 5) {
- Bus.send(Mic.K.activityDate, Date() + 2)
- }
- DispatchQueue.main.asyncAfter(deadline: .now() + 6) {
- Bus.send(Mic.K.activityDate, Date() + 7)
- }
- }
-
- var subscriptions = [AnyCancellable]()
- func testMic2_id(_ id: String) {
- DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
- Bus.send(Bus.keyId(Mic.K.activityDate, id), Date() + 2)
- }
-
- DispatchQueue.main.asyncAfter(deadline: .now() + 5) {
- Bus.send(Bus.keyId(Mic.K.activityDate, id), Date() + 2)
- }
- DispatchQueue.main.asyncAfter(deadline: .now() + 6) {
- Bus.send(Bus.keyId(Mic.K.activityDate, id), Date() + 3)
- }
- }
-
- func testMic4() {
- let ad1 = [
- "1": Date().addingTimeInterval(3),
- "2": Date().addingTimeInterval(5),
- ]
- Bus.send(Mic.K.activityDates, ad1)
-
- DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
- let ad2 = [
- "1": Date().addingTimeInterval(3),
- "4": Date().addingTimeInterval(5),
- ]
- Bus.send(Mic.K.activityDates, ad2)
- }
- }
- }
|