Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,14 @@ public class NavigationBar: UINavigationBar {
if #available(iOS 15.0, *) {
compactScrollEdgeAppearance = NavigationBarAppearance()
}
isTranslucent = false

if #available(iOS 26.0, *) {
isOpaque = false
isTranslucent = true
} else {
isOpaque = true
isTranslucent = false
}
}

// MARK: Bar Button Appearance
Expand All @@ -26,12 +33,12 @@ public class NavigationBar: UINavigationBar {

public static let buttonTitleTextAttributes = [
NSAttributedString.Key.font: UIFont.navigationBarButtonFont,
.foregroundColor: UIColor.white,
.foregroundColor: UIColor.controlTint,
]

public static let titleTextAttributes = [
NSAttributedString.Key.font: UIFont.navigationBarTitleFont,
.foregroundColor: UIColor.white,
.foregroundColor: UIColor.controlTint,
]

// MARK: Boilerplate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,15 @@ import UIKit
public class NavigationBarAppearance: UINavigationBarAppearance {
public override init(idiom: UIUserInterfaceIdiom = UIDevice.current.userInterfaceIdiom) {
super.init(idiom: idiom)
configureWithOpaqueBackground()
backgroundColor = .primaryDark

if #available(iOS 26.0, *) {
configureWithTransparentBackground()
backgroundColor = .clear
} else {
configureWithOpaqueBackground()
backgroundColor = .primaryDark
}

largeTitleTextAttributes = NavigationBar.largeTitleTextAttributes
titleTextAttributes = NavigationBar.titleTextAttributes
backButtonAppearance.normal.titleTextAttributes = NavigationBar.buttonTitleTextAttributes
Expand Down
2 changes: 2 additions & 0 deletions Modules/Capabilities/EditingToolbar/Sources/ActionSet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ public struct ActionSet {
if sizeClass == .regular {
UndoBarButtonItem(undoManager: undoManager, target: target)
RedoBarButtonItem(undoManager: undoManager, target: target)
UIBarButtonItem.fixedSpace(0)
ColorPickerBarButtonItem(target: target, color: currentColor)
UIBarButtonItem.fixedSpace(0)
SeekBarButtonItem(target: target)

if shouldShowQuickRedact { QuickRedactBarButtonItem(target: target) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ public class DismissBarButtonItem: UIBarButtonItem {
self.title = EditingToolbarStrings.DismissBarButtonItem.title
self.target = self
self.action = #selector(handleButton)

if #available(iOS 26.0, *) {
self.tintColor = .clear
}
}

@objc private func handleButton() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,24 @@ class PhotoLibraryViewController: UIViewController, UICollectionViewDelegate, UI
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)

if shouldScrollToBottom {
libraryView.layoutIfNeeded()
libraryView.scrollToItem(at: dataSource.lastItemIndexPath, at: .bottom, animated: false)
shouldScrollToBottom = false
}

let cellCount = libraryView.numberOfItems(inSection: 0)
if cellCount != dataSource.itemsCount {
libraryView.reloadData()
}
}

override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
scrollToBottom()
}

@objc func scrollToBottom() {
guard shouldScrollToBottom else { return }
libraryView.layoutIfNeeded()
libraryView.scrollToItem(at: dataSource.lastItemIndexPath, at: .bottom, animated: false)
shouldScrollToBottom = false
}

func reloadData() {
libraryView.reloadData()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ class AppViewController: UIViewController, PhotoEditorPresenting, DocumentScanni
#endif
}

override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
switch traitCollection.userInterfaceIdiom {
case .phone, .tv, .carPlay, .mac, .unspecified: .portrait
case .pad, .vision: .all
@unknown default: .portrait
}
}

@objc func showPhotoLibrary() {
transition(to: preferredViewController)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
// Created by Geoff Pado on 4/27/19.
// Copyright © 2019 Cocoatype, LLC. All rights reserved.

import UIKit

import Geometry
import Observations
import UIKit
import Redactions
import Tools

class PhotoEditingScrollView: UIScrollView {
init() {
workspaceView = PhotoEditingWorkspaceView()

super.init(frame: .zero)

if #available(iOS 26.0, *) {
contentInsetAdjustmentBehavior = .never
}

backgroundColor = .appBackground
delegate = scrollViewDelegate
showsHorizontalScrollIndicator = false
showsVerticalScrollIndicator = false
translatesAutoresizingMaskIntoConstraints = false

addSubview(workspaceView)

Expand All @@ -29,6 +36,11 @@ class PhotoEditingScrollView: UIScrollView {

private(set) var workspaceView: PhotoEditingWorkspaceView

public var color: UIColor {
get { return workspaceView.color }
set(newColor) { workspaceView.color = newColor }
}

var image: UIImage? {
get { return workspaceView.image }
set(newImage) {
Expand All @@ -41,6 +53,7 @@ class PhotoEditingScrollView: UIScrollView {
get { return workspaceView.textObservations }
set(newTextObservations) {
workspaceView.textObservations = newTextObservations
updateAccessibilityElements()
}
}

Expand All @@ -55,6 +68,60 @@ class PhotoEditingScrollView: UIScrollView {
workspaceView.redactableCharacterObservations
}

var seekPreviewObservations: [CharacterObservation] {
get { workspaceView.seekPreviewObservations }
set(newTextObservations) {
workspaceView.seekPreviewObservations = newTextObservations
}
}

public var highlighterTool: HighlighterTool {
get { return workspaceView.highlighterTool }
set(newTool) {
workspaceView.highlighterTool = newTool
}
}

// MARK: Redaction

public var redactions: [Redaction] {
workspaceView.redactions
}

public func add(_ redactions: [Redaction]) {
workspaceView.add(redactions)
}

func redact(_ observations: [any TextObservation], joinSiblings: Bool) {
workspaceView.redact(observations, joinSiblings: joinSiblings)
updateAccessibilityElements()
}

func unredact(_ observation: any TextObservation) {
workspaceView.unredact(observation)
updateAccessibilityElements()
}

// MARK: Accessibility

private func updateAccessibilityElements() {
let wordObservations = recognizedTextObservations?.flatMap(\.allWordObservations) ?? []
let accessibilityElements = wordObservations.map { observation in
WordObservationAccessibilityElement(observation, in: workspaceView) { [weak self] observation, isRedacted -> Bool in
if isRedacted {
self?.unredact(observation)
} else {
self?.redact([observation], joinSiblings: true)
}

return true
}
}

workspaceView.accessibilityElements = accessibilityElements
workspaceView.accessibilityCustomRotors = [RedactedWordObservationRotor(accessibilityElements: accessibilityElements)]
}

// MARK: View Lifecycle

override func layoutSubviews() {
Expand Down Expand Up @@ -103,6 +170,8 @@ class PhotoEditingScrollView: UIScrollView {

// MARK: Boilerplate

private let scrollViewDelegate = PhotoEditingScrollViewDelegate()

@available(*, unavailable)
required init(coder: NSCoder) {
let className = String(describing: type(of: self))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Created by Geoff Pado on 8/31/25.
// Copyright © 2025 Cocoatype, LLC. All rights reserved.

import UIKit

class PhotoEditingScrollViewDelegate: NSObject, UIScrollViewDelegate {
func viewForZooming(in scrollView: UIScrollView) -> UIView? {
guard let scrollView = scrollView as? PhotoEditingScrollView else {
return nil
}

return scrollView.workspaceView
}

func scrollViewDidZoom(_ scrollView: UIScrollView) {
guard let scrollView = scrollView as? PhotoEditingScrollView else {
return
}

scrollView.workspaceView.scrollViewDidZoom(to: scrollView.zoomScale)
}
}
125 changes: 0 additions & 125 deletions Modules/Legacy/Editing/Sources/Editing View/PhotoEditingView.swift

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ public class PhotoEditingViewController: UIViewController, UIScrollViewDelegate,
private var colorObserver: Any?
private let imageManager = PHImageManager()
private let textRectangleDetector = TextDetector()
private let photoEditingView = PhotoEditingView()
private let photoEditingView = PhotoEditingScrollView()
private var redactionChangeObserver: Any?
private var hideAutoRedactionsChangeObserver: Any?

Expand Down
Loading