Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

visionOS support #239

Merged
merged 1 commit into from
Apr 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 33 additions & 9 deletions Pulse.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 53;
objectVersion = 55;
objects = {

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -87,10 +87,10 @@
0C70EA812A3F6190000B1071 /* repos.json in Resources */ = {isa = PBXBuildFile; fileRef = 0CDACDE129EC6607007C15CD /* repos.json */; };
0C70EA822A3F619A000B1071 /* MockStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0CF0D5B0296F189500EED9D4 /* MockStore.swift */; };
0C70EA832A3F619A000B1071 /* MockTask.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0CF0D5AF296F189500EED9D4 /* MockTask.swift */; };
0C70EA842A3F61F9000B1071 /* Pulse.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0CF0D542296F14EA00EED9D4 /* Pulse.framework */; };
0C70EA852A3F61F9000B1071 /* Pulse.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 0CF0D542296F14EA00EED9D4 /* Pulse.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
0C70EA882A3F61F9000B1071 /* PulseUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0CF0D56C296F17CB00EED9D4 /* PulseUI.framework */; };
0C70EA892A3F61F9000B1071 /* PulseUI.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 0CF0D56C296F17CB00EED9D4 /* PulseUI.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
0C70EA842A3F61F9000B1071 /* Pulse.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0CF0D542296F14EA00EED9D4 /* Pulse.framework */; platformFilters = (ios, tvos, watchos, xros, ); };
0C70EA852A3F61F9000B1071 /* Pulse.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 0CF0D542296F14EA00EED9D4 /* Pulse.framework */; platformFilters = (ios, tvos, watchos, xros, ); settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
0C70EA882A3F61F9000B1071 /* PulseUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0CF0D56C296F17CB00EED9D4 /* PulseUI.framework */; platformFilters = (ios, tvos, watchos, xros, ); };
0C70EA892A3F61F9000B1071 /* PulseUI.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 0CF0D56C296F17CB00EED9D4 /* PulseUI.framework */; platformFilters = (ios, tvos, watchos, xros, ); settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
0C7A0DFB297C33F300B4B69D /* ConsoleRouterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0C7A0DFA297C33F300B4B69D /* ConsoleRouterView.swift */; };
0C7A0E00297C51CE00B4B69D /* ConsoleListOptions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0C7A0DFF297C51CE00B4B69D /* ConsoleListOptions.swift */; };
0C7A0E02297CE71400B4B69D /* FormattersTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0C7A0E01297CE71400B4B69D /* FormattersTests.swift */; };
Expand Down Expand Up @@ -2202,11 +2202,23 @@
};
0C70EA872A3F61F9000B1071 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
platformFilters = (
ios,
tvos,
watchos,
xros,
);
target = 0CF0D541296F14EA00EED9D4 /* Pulse */;
targetProxy = 0C70EA862A3F61F9000B1071 /* PBXContainerItemProxy */;
};
0C70EA8B2A3F61F9000B1071 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
platformFilters = (
ios,
tvos,
watchos,
xros,
);
target = 0CF0D56B296F17CB00EED9D4 /* PulseUI */;
targetProxy = 0C70EA8A2A3F61F9000B1071 /* PBXContainerItemProxy */;
};
Expand Down Expand Up @@ -2760,12 +2772,12 @@
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = "com.github.kean.pulse-demo";
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator watchos watchsimulator";
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator watchos watchsimulator xros xrsimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = "1,2,7";
};
name = Debug;
};
Expand Down Expand Up @@ -2804,13 +2816,13 @@
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = "com.github.kean.pulse-demo";
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator watchos watchsimulator";
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator watchos watchsimulator xros xrsimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = PULSE_MOCK_INCLUDED;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = "1,2,7";
};
name = Release;
};
Expand Down Expand Up @@ -2937,8 +2949,11 @@
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SDKROOT = auto;
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx watchos watchsimulator xros xrsimulator";
SUPPORTS_MACCATALYST = YES;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 7;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
Expand Down Expand Up @@ -2971,7 +2986,10 @@
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SDKROOT = auto;
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx watchos watchsimulator xros xrsimulator";
SUPPORTS_MACCATALYST = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 7;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
Expand Down Expand Up @@ -3004,9 +3022,12 @@
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SDKROOT = auto;
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx watchos watchsimulator xros xrsimulator";
SUPPORTS_MACCATALYST = YES;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 7;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
Expand Down Expand Up @@ -3038,8 +3059,11 @@
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SDKROOT = auto;
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx watchos watchsimulator xros xrsimulator";
SUPPORTS_MACCATALYST = YES;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 7;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
Expand Down
2 changes: 1 addition & 1 deletion Sources/Pulse/LoggerStore/LoggerStore+Info.swift
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ private func getAppIcon() -> Data? {
return Graphics.encode(thumbnail)
}

#if os(iOS) || os(tvOS)
#if os(iOS) || os(tvOS) || os(visionOS)
import UIKit

func getDeviceId() -> UUID? {
Expand Down
2 changes: 1 addition & 1 deletion Sources/PulseUI/Extensions/Foundation+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ extension Character {
}
}

@available(iOS 15, *)
@available(iOS 15, visionOS 1.0, *)
extension AttributedString {
init(_ string: String, _ configure: (inout AttributeContainer) -> Void) {
var attributes = AttributeContainer()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import Foundation

#if os(iOS) || os(macOS)
#if os(iOS) || os(macOS) || os(visionOS)

extension NSAttributedString {
func getLines() -> [NSAttributedString] {
Expand Down
8 changes: 4 additions & 4 deletions Sources/PulseUI/Extensions/SwiftUI+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import SwiftUI
import Combine

#if os(iOS) || os(macOS)
#if os(iOS) || os(macOS) || os(visionOS)
extension Color {
static var separator: Color { Color(UXColor.separator) }
static var secondaryFill: Color { Color(UXColor.secondarySystemFill) }
Expand Down Expand Up @@ -45,7 +45,7 @@ extension ContentSizeCategory {
}
}

#if os(iOS)
#if os(iOS) || os(visionOS)

enum Keyboard {
static var isHidden: AnyPublisher<Bool, Never> {
Expand Down Expand Up @@ -77,7 +77,7 @@ extension View {
extension Backport {
@ViewBuilder
func presentationDetents(_ detents: Set<PresentationDetent>) -> some View {
#if os(iOS)
#if os(iOS) || os(visionOS)
if #available(iOS 16, *) {
let detents = detents.map { (detent)-> SwiftUI.PresentationDetent in
switch detent {
Expand Down Expand Up @@ -114,7 +114,7 @@ extension Backport {
extension View {
func inlineNavigationTitle(_ title: String) -> some View {
self.navigationTitle(title)
#if os(iOS)
#if os(iOS) || os(visionOS)
.navigationBarTitleDisplayMode(.inline)
#endif
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/PulseUI/Features/Console/ConsoleEnvironment.swift
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ final class ConsoleEnvironment: ObservableObject {
store.removeAll()
index.clear()

#if os(iOS)
#if os(iOS) || os(visionOS)
runHapticFeedback(.success)
#endif
}
Expand Down
6 changes: 3 additions & 3 deletions Sources/PulseUI/Features/Console/ConsoleView-ios.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// Copyright (c) 2020–2023 Alexander Grebenyuk (github.com/kean).

#if os(iOS)
#if os(iOS) || os(visionOS)

import SwiftUI
import CoreData
Expand All @@ -27,7 +27,7 @@ public struct ConsoleView: View {
}
}

@available(iOS 15, *)
@available(iOS 15, visionOS 1.0, *)
private var contents: some View {
ConsoleListView()
.navigationTitle(environment.title)
Expand All @@ -53,7 +53,7 @@ public struct ConsoleView: View {
return copy
}

@available(iOS 15, *)
@available(iOS 15, visionOS 1.0, *)
@ViewBuilder private var trailingNavigationBarItems: some View {
Button(action: { environment.router.isShowingShareStore = true }) {
Image(systemName: "square.and.arrow.up")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Pulse
import Combine
import SwiftUI

@available(iOS 15, macOS 13, *)
@available(iOS 15, macOS 13, visionOS 1.0, *)
struct ConsoleListContentView: View {
@EnvironmentObject var viewModel: ConsoleListViewModel

Expand All @@ -18,7 +18,7 @@ struct ConsoleListContentView: View {
#endif

var body: some View {
#if os(iOS)
#if os(iOS) || os(visionOS)
if !viewModel.pins.isEmpty, !viewModel.isShowingFocusedEntities {
ConsoleListPinsSectionView(viewModel: viewModel)
if !viewModel.entities.isEmpty {
Expand All @@ -27,7 +27,7 @@ struct ConsoleListContentView: View {
}
#endif

#if os(iOS) || os(macOS)
#if os(iOS) || os(macOS) || os(visionOS)
if let sections = viewModel.sections, !sections.isEmpty {
ForEach(sections, id: \.name) {
ConsoleListGroupedSectionView(section: $0, viewModel: viewModel)
Expand All @@ -54,7 +54,7 @@ struct ConsoleListContentView: View {
let objectID = entity.objectID
ConsoleEntityCell(entity: entity)
.id(objectID)
#if os(iOS)
#if os(iOS) || os(visionOS)
.onAppear { viewModel.onAppearCell(with: objectID) }
.onDisappear { viewModel.onDisappearCell(with: objectID) }
#endif
Expand All @@ -80,7 +80,7 @@ struct ConsoleListContentView: View {
.foregroundColor(.secondary)
}
.buttonStyle(.plain)
#if os(iOS)
#if os(iOS) || os(visionOS)
.listRowSeparator(.hidden, edges: .bottom)
#endif
}
Expand Down Expand Up @@ -143,8 +143,8 @@ struct BottomViewID: Hashable, Identifiable {
}
#endif

#if os(iOS) || os(macOS)
@available(iOS 15, macOS 13, *)
#if os(iOS) || os(macOS) || os(visionOS)
@available(iOS 15, macOS 13, visionOS 1.0, *)
struct ConsoleStaticList: View {
let entities: [NSManagedObject]

Expand All @@ -153,7 +153,7 @@ struct ConsoleStaticList: View {
ForEach(entities, id: \.objectID, content: ConsoleEntityCell.init)
}
.listStyle(.plain)
#if os(iOS)
#if os(iOS) || os(visionOS)
.environment(\.defaultMinListRowHeight, 8)
#endif
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
//
// Copyright (c) 2020–2023 Alexander Grebenyuk (github.com/kean).

#if os(iOS) || os(macOS)
#if os(iOS) || os(macOS) || os(visionOS)

import CoreData
import Pulse
import Combine
import SwiftUI

@available(iOS 15, macOS 13, *)
@available(iOS 15, macOS 13, visionOS 1.0, *)
struct ConsoleListGroupedSectionView: View {
let section: NSFetchedResultsSectionInfo
@ObservedObject var viewModel: ConsoleListViewModel
Expand All @@ -25,7 +25,7 @@ struct ConsoleListGroupedSectionView: View {
ForEach(prefix, id: \.objectID, content: ConsoleEntityCell.init)

if prefix.count < objects.count {
#if os(iOS)
#if os(iOS) || os(visionOS)
NavigationLink(destination: ConsoleStaticList(entities: objects).inlineNavigationTitle(title)) {
PlainListSeeAllView(count: objects.count)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
//
// Copyright (c) 2020–2023 Alexander Grebenyuk (github.com/kean).

#if os(iOS)
#if os(iOS) || os(visionOS)

import CoreData
import Pulse
import Combine
import SwiftUI

@available(iOS 15, *)
@available(iOS 15, visionOS 1.0, *)
struct ConsoleListPinsSectionView: View {
@ObservedObject var viewModel: ConsoleListViewModel

Expand Down
16 changes: 8 additions & 8 deletions Sources/PulseUI/Features/Console/List/ConsoleListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
//
// Copyright (c) 2020–2023 Alexander Grebenyuk (github.com/kean).

#if os(iOS) || os(macOS)
#if os(iOS) || os(macOS) || os(visionOS)

import SwiftUI
import CoreData
import Pulse
import Combine

@available(iOS 15, macOS 13, *)
@available(iOS 15, macOS 13, visionOS 1.0, *)
struct ConsoleListView: View {
@EnvironmentObject var environment: ConsoleEnvironment
@EnvironmentObject var filters: ConsoleFiltersViewModel
Expand All @@ -19,7 +19,7 @@ struct ConsoleListView: View {
}
}

@available(iOS 15, macOS 13, *)
@available(iOS 15, macOS 13, visionOS 1.0, *)
private struct _InternalConsoleListView: View {
private let environment: ConsoleEnvironment

Expand Down Expand Up @@ -66,15 +66,15 @@ private struct _InternalConsoleListView: View {
#endif
.onSubmit(of: .search, searchViewModel.value.onSubmitSearch)
.disableAutocorrection(true)
#if os(iOS)
#if os(iOS) || os(visionOS)
.textInputAutocapitalization(.never)
#endif
} else {
_ConsoleListView()
.searchable(text: $searchBarViewModel.text)
.onSubmit(of: .search, searchViewModel.value.onSubmitSearch)
.disableAutocorrection(true)
#if os(iOS)
#if os(iOS) || os(visionOS)
.textInputAutocapitalization(.never)
#endif
}
Expand All @@ -83,8 +83,8 @@ private struct _InternalConsoleListView: View {

#endif

#if os(iOS)
@available(iOS 15, *)
#if os(iOS) || os(visionOS)
@available(iOS 15, visionOS 1.0, *)
private struct _ConsoleListView: View {
@Environment(\.isSearching) private var isSearching
@Environment(\.store) private var store
Expand Down Expand Up @@ -133,7 +133,7 @@ private struct _ConsoleListView: View {
#endif

#if os(macOS)
@available(iOS 15, macOS 13, *)
@available(iOS 15, macOS 13, visionOS 1.0, *)
private struct _ConsoleListView: View {
@EnvironmentObject private var environment: ConsoleEnvironment
@EnvironmentObject private var listViewModel: ConsoleListViewModel
Expand Down
Loading
Loading