Posts

Post not yet marked as solved
0 Replies
390 Views
what happened? i never noticed it until i decided to use ipad air and pro as option in chrome dev console mobile view as well as ios simulator. it works ok in the ipad mini. touch events do not get triggered. instead, the scroll seems to overlap these. EDIT: Solved. please see comment below. While it works ok in ipad pro devices now, I still wish this could work out in chrome's dev console ipad pro view. the behavior is different with click events. instead of mouse down, it starts with mouse move. what gives? this only happens in ipad air and pro view in the device toolbar in dev console.
Posted
by chitgoks.
Last updated
.
Post marked as solved
2 Replies
2.8k Views
Anyone got sample code for using AVPlayerLooper in SwiftUI? Code i see are not for SwiftUI I only wish to have the option to turn on auto-repeat on and off. I could use AVQueuePlayer as replacement for AVPlayer but it does not have a way to loop. So these are what I am looking for Loop video in SwiftUI If Using AVPlayerLooper, it has a disableLooping() function (possibly to turn off looping). But how can it be turned back on? There is no enableLooping(). Or does it need a new instance? since i am new to iOS, the code there are all linked to no swift ui code so I have no clue (sorry) the equivalent of them in SwiftUI Thoughts?
Posted
by chitgoks.
Last updated
.
Post marked as solved
2 Replies
329 Views
Hi, what do you think is wrong with the fucntion. This is what I have. Could it be because of the roundmode type used? static func roundOff(_ val: String, _ decimalPlace: Int) -> String {     let decimalFormatter = createDecimalFormatter()     decimalFormatter.minimumFractionDigits = decimalPlace     decimalFormatter.maximumFractionDigits = decimalPlace     let bigDecimal = NSDecimalNumber(string: val)     return decimalFormatter.string(from: bigDecimal.rounding(accordingToBehavior: NSDecimalNumberHandler(roundingMode: .up, scale: Int16(decimalPlace), raiseOnExactness: false, raiseOnOverflow: false, raiseOnUnderflow: false, raiseOnDivideByZero: false)))!   }   static func roundOff(_ value: Double, _ decimalPlace: Int) -> String {     return roundOff(String(value), decimalPlace)   } roundOf("75.2", 0) returns 76 instead of 75
Posted
by chitgoks.
Last updated
.
Post marked as solved
3 Replies
412 Views
Hi all. I am not sure what is wrong with my current code. What I am looking to do is change all values of a string with a substring of "around #C" where # is the temperature. I am converting between farenheit and celsius and i wish to get all substrings then change the correct value depending on the current setting. So if i have a string where "This is today. The temperature is around 14C. Tomorrow the temperature will be around 18C" So the regex would get "around 14C" and "around 18C" and change the values to farenheit. Result would be something like "This is today. The temperature is around -1F. Tomorrow the temperature will be around -4F" This is my function. func formatCorrectDetail(_ detail: String, _ isCelsius: Bool) -> String {     let regex = try! NSRegularExpression(pattern: "around ((\\d+)" + (isCelsius ? "F" : "C") + ")", options: [])     let matches = regex.matches(in: detail, options: [], range: NSRange(location: 0, length: detail.utf16.count))     let formattedString = NSMutableString(string: detail)     for match in matches {       let range = match.range(at: 2)       if let rangeSubstring = Range(range, in: detail),         let temperature = Double(String(detail[rangeSubstring])) {         let val = isCelsius ? NumberTool.far2cel(temperature) : NumberTool.cel2far(temperature)         formattedString.replaceCharacters(in: range, with: val)       }     }     if formattedString.length > 0 {       return String(formattedString)     }     else {       return detail     }   } The NumberTool.far2cel() and NumberTool.cel2far() are my custom functions to convert between celsius and farehnheit. Thoughts?
Posted
by chitgoks.
Last updated
.
Post not yet marked as solved
1 Replies
596 Views
This one is about the .app not found. I am not sure why. And i have not seen a post about a .app not being found. Build input file cannot be found: '.../DerivedData/...../Build/Products/Debug-iphonesimulator/......app/.....'. Did you forget to declare this file as an output of a script phase or custom build rule which produces it? Thoughts what could be wrong?
Posted
by chitgoks.
Last updated
.
Post not yet marked as solved
1 Replies
791 Views
Hi all. Any clue why BGTaskScheduler.shared.register() does not get called? The print does not show anything to console. I already registered them in Permitted Background task scheduler identifiers and added 2 items for package.Task.updateAppRefresh package.Task.updateAppProcessing I re-read the tutorial and I cannot figure out what else i am lacking? Thoughts?
Posted
by chitgoks.
Last updated
.
Post not yet marked as solved
1 Replies
363 Views
So ive read there is no feature in the Foundation package that outputs a date only object. Ive tried variations seen in forum posts. One of them is like this. But i am confused why the output is always 16:00:00 +0000 for the time instead of 00:00:00 +0000? This is the code Calendar.current.date(bySettingHour: 0, minute: 0, second: 0, of: Date())! 16:00:00 is 4PM. Instead of 12:00AM When I run it in this site online swift playground https://online.swiftplayground.run/ i get this output 2023-02-26 23:00:00 +0000 I figure this could be because of timezone. But is there a way to get a date object where the value of time is midnight? 00:00:00? Thoughts?
Posted
by chitgoks.
Last updated
.
Post marked as solved
3 Replies
1.4k Views
My sample function is this func temp(type: String, callback: (() -> Void)? = nil) { callback?() } But why can't I do this? temp(type: "Here", () -> { print("hey") }) It says, Expected type after '->' While this does work temp(type: "Here", { () -> Void in print("hey") }) I find it weird why the () -> Void has to be inside the closure.
Posted
by chitgoks.
Last updated
.
Post not yet marked as solved
0 Replies
392 Views
Hi all. This is more of a discussion thread than a question about getting some code answers. I am reading about background tasks and the Apple documentation example is not even complete and unusable. Just bits and pieces of code so a newbie like me doesnt find it helpful. What I am trying to do is run a background task even when the app is closed at 3 hour intervals. I have not seen any solution to this. is this possible? I figured trying to also look if it is possible to listen to when the user's internet connection is on or off because once it will be one, the service will run. if the internet is turned off, it disables the service (is this possible?) I used this url as guide https://developer.apple.com/documentation/uikit/app_and_environment/scenes/preparing_your_ui_to_run_in_the_background/using_background_tasks_to_update_your_app#3193599 Note: I dont even know what RefreshAppContentsOperation is. At least they should have included the source for this. Or even if it's part of the sdk, at least include the import for this.
Posted
by chitgoks.
Last updated
.
Post not yet marked as solved
0 Replies
388 Views
I wish to set Calendar.current.date() details to AM or PM but i do not see any way. or is it possible? how? there is also a setting called .nanosecond. is this the same as millisecond?
Posted
by chitgoks.
Last updated
.
Post not yet marked as solved
1 Replies
393 Views
See sample class class A { var proxy: A init () { proxy = self } } In Java, i could do something like this class A { A proxy; A () { proxy = this } } so when i instantiate A sample = new A(); the proxy variable will be set to the "this" keyword. But in Swift, the only related keyword to it is self but it does not behave the same way. It merely serves somewhat of a pointer to properties and methods that it belongs to it. Is this possible in Swift? if yes, how to go about this? I could not find any solution (perhaps because there is a term for that style? which I have no clue about) thoughts?
Posted
by chitgoks.
Last updated
.
Post marked as solved
1 Replies
322 Views
Hi, i have only seen for loop samples that involve indexes or using for item in items. I come from a java background and i cannot seem to confirm if this can actually be converted to a swift for loop. thoughts? for (EdgeNode edge = aet.topNode ; (edge != null); edge = edge.next)
Posted
by chitgoks.
Last updated
.
Post not yet marked as solved
0 Replies
291 Views
I have a question regarding releasing an app to a device. I tried to release a debug app but I noticed that when i disconnect the cable from the device, the app cannot be run anymore. So instead, I have to transfer a release app to the device. However, there are some things I do not understand with regards to profiles. Do i have to create a provisioning profile just to be able to have my release built app installed in my iPhone? Or is there another way. Because while looking into this, I came to a conclusion that I have to have a developer account (which forces me to pay 100usd per year). And i have no plans to publish any app until I manage to finish 3 of them. I only plan to get a developer account once. all 3 are tried and tested in a real device. Thoughts?
Posted
by chitgoks.
Last updated
.
Post not yet marked as solved
1 Replies
355 Views
Please see screenshot. Currently the one in white has an animation in the middle. i wish to set the background of the body's view to transparent so that only the animation from my app is visible (it's like the home screen but only my animation is shown when the app is run. Is that possible? I tried to set VStack's background color opacity to 0 but nothing happpens. Or is it something else that needs to be modified? Thoughts?
Posted
by chitgoks.
Last updated
.
Post marked as solved
1 Replies
419 Views
struct TweetFeedSelectionGridView: View {   private let ICON_SIZE: CGFloat = 40   private let ROW_BOTTOM_PADDING: CGFloat = 40       var body: some View {     Grid(alignment: .top, verticalSpacing: ROW_BOTTOM_PADDING) {       createTwitterFeedRow(["TwitterDilg", "TwitterDoh", "TwitterDole"])       createTwitterFeedRow(["TwitterDswd", "TwitterDepEd", "TwitterMmda"])       createTwitterFeedRow(["TwitterNdrmmc", "TwitterPagasa", "TwitterPcoo"])       createTwitterFeedRow(["TwitterPhivolcs", "TwitterPia", "TwitterPna"])       createTwitterFeedRow(["TwitterPnp", "TwitterRedCross", "TwitterTxtFire"])     }     .frame(maxWidth: .infinity)     .background(.red)   }       @ViewBuilder   func createTwitterFeedRow(_ feeds: [String]) -> some View {     GridRow {       createTwittedFeedCell(feeds[0])       createTwittedFeedCell(feeds[1])       createTwittedFeedCell(feeds[2])     }     .frame(maxWidth: .infinity)   }       @ViewBuilder   func createTwittedFeedCell(_ iconLabel: String) -> some View {     VStack {       Image(uiImage: UIImage(named: iconLabel)!)         .frame(width: ICON_SIZE, height: ICON_SIZE)       Text(iconLabel.replacingOccurrences(of: "Twitter", with: ""))         .padding(.top, 10)     }   } } struct TwitterFeedSelectionGridView_Previews: PreviewProvider {   static var previews: some View {     TweetFeedSelectionGridView()   } } Why does the image in the first row overlap? I have no clue why. The image is an ImageSet of 80, 160 and 240x240 images.
Posted
by chitgoks.
Last updated
.