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_WIDGETS = com.neon443.NearFuture.widgets
|
||||
GROUP_ID = group.NearFuture
|
||||
VERSION = 5
|
||||
VERSION = 5.0.1
|
||||
NAME = Near Future
|
||||
BUILD_NUMBER = 27
|
||||
BUILD_NUMBER = 52
|
||||
|
||||
@@ -54,7 +54,7 @@ struct ContentView: View {
|
||||
}
|
||||
.tag(Tab.settings)
|
||||
}
|
||||
.hapticHeavy(trigger: tabSelection)
|
||||
.modifier(hapticHeavy(trigger: tabSelection))
|
||||
.sheet(isPresented: $settingsModel.settings.showWhatsNew) {
|
||||
WhatsNewView(settingsModel: settingsModel)
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ struct AddEventView: View {
|
||||
.padding(.trailing, event.notes.isEmpty ? 0 : 30)
|
||||
.animation(.spring, value: event.notes)
|
||||
.focused($focusedField, equals: Field.Notes)
|
||||
.submitLabel(.done)
|
||||
.lineLimit(5)
|
||||
.onSubmit {
|
||||
focusedField = nil
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ struct WhatsNewView: View {
|
||||
}
|
||||
.foregroundStyle(.orange)
|
||||
.modifier(glassButton())
|
||||
.hapticHeavy(trigger: bye)
|
||||
.modifier(hapticHeavy(trigger: bye))
|
||||
}
|
||||
.scrollContentBackground(.hidden)
|
||||
.presentationDragIndicator(.visible)
|
||||
|
||||
@@ -8,19 +8,39 @@
|
||||
import Foundation
|
||||
import SwiftUI
|
||||
|
||||
extension View {
|
||||
func hapticHeavy(trigger: any Equatable) -> some View {
|
||||
#if canImport(UIKit)
|
||||
if #available(iOS 17, *) {
|
||||
self.modifier(sensoryFeedback(.impact(weight: .heavy, intensity: 1), trigger: trigger)) as! Self
|
||||
} else {
|
||||
self
|
||||
struct hapticHeavy<T: Equatable>: ViewModifier {
|
||||
var trigger: T
|
||||
|
||||
init(trigger: T) {
|
||||
self.trigger = trigger
|
||||
}
|
||||
#else
|
||||
self
|
||||
|
||||
func body(content: Content) -> some View {
|
||||
content
|
||||
.onChange(of: trigger) { _ in
|
||||
#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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct glassButton: ViewModifier {
|
||||
func body(content: Content) -> some View {
|
||||
@@ -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 {
|
||||
func body(content: Content) -> some View {
|
||||
#if os(macOS)
|
||||
|
||||
Reference in New Issue
Block a user