File tree Expand file tree Collapse file tree
PennMobile/Dining/SwiftUI Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -81,7 +81,6 @@ struct DiningAnalyticsView: View {
8181 showMissingDiningTokenAlert = true
8282 return
8383 }
84- await diningAnalyticsViewModel. refresh ( refreshWidgets: true )
8584 }
8685 . alert ( isPresented: $showMissingDiningTokenAlert) {
8786 showCorrectAlert ( )
Original file line number Diff line number Diff line change @@ -203,6 +203,14 @@ extension String {
203203 func capitalizeFirstLetter( ) -> String {
204204 return self . prefix ( 1 ) . capitalized + self . dropFirst ( )
205205 }
206+ // Used for splitting string by regex expression
207+ func split( usingRegex pattern: String ) -> [ String ] {
208+ // Crashes when you pass invalid pattern
209+ let regex = try ! NSRegularExpression ( pattern: pattern)
210+ let matches = regex. matches ( in: self , range: NSRange ( 0 ..< utf16. count) )
211+ let ranges = [ startIndex..< startIndex] + matches. map { Range ( $0. range, in: self ) !} + [ endIndex..< endIndex]
212+ return ( 0 ... matches. count) . map { String ( self [ ranges [ $0] . upperBound..< ranges [ $0+ 1 ] . lowerBound] ) }
213+ }
206214}
207215
208216struct Line : Shape {
@@ -213,14 +221,3 @@ struct Line: Shape {
213221 return path
214222 }
215223}
216-
217- // Used for splitting string by regex expression
218- extension String {
219- func split( usingRegex pattern: String ) -> [ String ] {
220- // Crashes when you pass invalid pattern
221- let regex = try ! NSRegularExpression ( pattern: pattern)
222- let matches = regex. matches ( in: self , range: NSRange ( 0 ..< utf16. count) )
223- let ranges = [ startIndex..< startIndex] + matches. map { Range ( $0. range, in: self ) !} + [ endIndex..< endIndex]
224- return ( 0 ... matches. count) . map { String ( self [ ranges [ $0] . upperBound..< ranges [ $0+ 1 ] . lowerBound] ) }
225- }
226- }
Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ struct DiningVenueView: View {
3333 await diningVM. refreshVenues ( )
3434 await diningVM. refreshBalance ( )
3535 await diningVM. refreshMenus ( cache: true )
36+ await diningAnalyticsViewModel. refresh ( refreshWidgets: true )
3637 }
3738 . navigationBarHidden ( false )
3839 . listStyle ( . plain)
You can’t perform that action at this time.
0 commit comments