mirror of
https://github.com/neon443/NearFuture.git
synced 2026-03-11 06:49:12 +00:00
rewrote haptic viewmodifiers again :cry
made textfield expand and allowed the enter button fix crashes due to as! self
This commit is contained in:
@@ -12,6 +12,6 @@ TEAM_ID = 8JGND254B7
|
|||||||
BUNDLE_ID = com.neon443.NearFuture
|
BUNDLE_ID = com.neon443.NearFuture
|
||||||
BUNDLE_ID_WIDGETS = com.neon443.NearFuture.widgets
|
BUNDLE_ID_WIDGETS = com.neon443.NearFuture.widgets
|
||||||
GROUP_ID = group.NearFuture
|
GROUP_ID = group.NearFuture
|
||||||
VERSION = 5
|
VERSION = 5.0.1
|
||||||
NAME = Near Future
|
NAME = Near Future
|
||||||
BUILD_NUMBER = 27
|
BUILD_NUMBER = 52
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ struct ContentView: View {
|
|||||||
}
|
}
|
||||||
.tag(Tab.settings)
|
.tag(Tab.settings)
|
||||||
}
|
}
|
||||||
.hapticHeavy(trigger: tabSelection)
|
.modifier(hapticHeavy(trigger: tabSelection))
|
||||||
.sheet(isPresented: $settingsModel.settings.showWhatsNew) {
|
.sheet(isPresented: $settingsModel.settings.showWhatsNew) {
|
||||||
WhatsNewView(settingsModel: settingsModel)
|
WhatsNewView(settingsModel: settingsModel)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ struct AddEventView: View {
|
|||||||
.padding(.trailing, event.notes.isEmpty ? 0 : 30)
|
.padding(.trailing, event.notes.isEmpty ? 0 : 30)
|
||||||
.animation(.spring, value: event.notes)
|
.animation(.spring, value: event.notes)
|
||||||
.focused($focusedField, equals: Field.Notes)
|
.focused($focusedField, equals: Field.Notes)
|
||||||
.submitLabel(.done)
|
.lineLimit(5)
|
||||||
.onSubmit {
|
.onSubmit {
|
||||||
focusedField = nil
|
focusedField = nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ struct WhatsNewView: View {
|
|||||||
}
|
}
|
||||||
.foregroundStyle(.orange)
|
.foregroundStyle(.orange)
|
||||||
.modifier(glassButton())
|
.modifier(glassButton())
|
||||||
.hapticHeavy(trigger: bye)
|
.modifier(hapticHeavy(trigger: bye))
|
||||||
}
|
}
|
||||||
.scrollContentBackground(.hidden)
|
.scrollContentBackground(.hidden)
|
||||||
.presentationDragIndicator(.visible)
|
.presentationDragIndicator(.visible)
|
||||||
|
|||||||
@@ -8,17 +8,37 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
extension View {
|
struct hapticHeavy<T: Equatable>: ViewModifier {
|
||||||
func hapticHeavy(trigger: any Equatable) -> some View {
|
var trigger: T
|
||||||
#if canImport(UIKit)
|
|
||||||
if #available(iOS 17, *) {
|
init(trigger: T) {
|
||||||
self.modifier(sensoryFeedback(.impact(weight: .heavy, intensity: 1), trigger: trigger)) as! Self
|
self.trigger = trigger
|
||||||
} else {
|
}
|
||||||
self
|
|
||||||
}
|
func body(content: Content) -> some View {
|
||||||
#else
|
content
|
||||||
self
|
.onChange(of: trigger) { _ in
|
||||||
#endif
|
#if canImport(UIKit)
|
||||||
|
UIImpactFeedbackGenerator(style: .rigid).impactOccurred()
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct hapticSuccess<T: Equatable>: ViewModifier {
|
||||||
|
var trigger: T
|
||||||
|
|
||||||
|
init(trigger: T) {
|
||||||
|
self.trigger = trigger
|
||||||
|
}
|
||||||
|
|
||||||
|
func body(content: Content) -> some View {
|
||||||
|
content
|
||||||
|
.onChange(of: trigger) { _ in
|
||||||
|
#if canImport(UIKit)
|
||||||
|
UINotificationFeedbackGenerator().notificationOccurred(.success)
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,19 +54,6 @@ struct glassButton: ViewModifier {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension View {
|
|
||||||
func hapticSucess(trigger: any Equatable) -> some View {
|
|
||||||
#if canImport(UIKit)
|
|
||||||
if #available(iOS 17, *) {
|
|
||||||
self.modifier(sensoryFeedback(.success, trigger: trigger)) as! Self
|
|
||||||
} else {
|
|
||||||
self
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
self
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
struct navigationInlineLarge: ViewModifier {
|
struct navigationInlineLarge: ViewModifier {
|
||||||
func body(content: Content) -> some View {
|
func body(content: Content) -> some View {
|
||||||
#if os(macOS)
|
#if os(macOS)
|
||||||
|
|||||||
Reference in New Issue
Block a user