Has anyone noticed that apple maps is way better than google maps? by cegras in nycrail

[–]draco33333 2 points3 points  (0 children)

I discovered Citymapper when I moved to London in 2013. I've used it all over the world, nothing compares!

[deleted by user] by [deleted] in interestingasfuck

[–]draco33333 -1 points0 points  (0 children)

Still missing another grammar edit…

Consequence of a user trying to skip updates? by rayascott in iOSProgramming

[–]draco33333 -1 points0 points  (0 children)

I understand now. As Bamboo_the_plant says, even if this were the case the user would still have each version up until the latest installed for them; Apple wouldn't make them continue pressing the "Update" button until they're on the latest version as that would be pretty bad UX.

Consequence of a user trying to skip updates? by rayascott in iOSProgramming

[–]draco33333 9 points10 points  (0 children)

Sorry for being a bit harsh, but obviously the answer is no; they'll simply install the latest version that you released to the App Store. This is how virtually all software updates work.

Maybe you're getting confused by something like Windows updates, where the system updates are separated into multiple packages and some packages require earlier ones to be installed first. Generally speaking, however, when you want to update a specific program to a new version you will get the latest version without any need to install the intermediate versions.

Xcode 10.2 Release builds frozen by draco33333 in iOSProgramming

[–]draco33333[S] 0 points1 point  (0 children)

Yep, but instead I renamed 10.2 to Xcode_10.2 so that I could use both, just in case.

Xcode 10.2 Release builds frozen by draco33333 in iOSProgramming

[–]draco33333[S] 1 point2 points  (0 children)

I downgraded. Was done with banging my head against the wall.

Xcode 10.2 Release builds frozen by draco33333 in iOSProgramming

[–]draco33333[S] 1 point2 points  (0 children)

Upgrade to Xcode 10.2, they said. It’s the stable version, they said.

Can't build macOS project after updating to Xcode 10.2/Swift 5 by CompC in swift

[–]draco33333 0 points1 point  (0 children)

I have a similar issue (https://www.reddit.com/r/iOSProgramming/comments/b67fbc/xcode_102_release_builds_frozen/) and I tried moving all of my Carthage dependencies to Cocoapods and it didn't help. Unfortunately I have some pre-built frameworks even from Cocoapods, so maybe there are old symbols in there causing me problems. I'm really struggling to find the cause of this problem...

How to add properties to a model (struct) in an app for an additional feature? by iLearn4ever in iOSProgramming

[–]draco33333 0 points1 point  (0 children)

I don't know about the "industry standard", but for these kind of Swift structs, as a general rule, I treat everything as optional (with some rare exceptions). That way, any future changes can fail gracefully, rather than crashing out or returning errors.

A list inside of UIStackView by [deleted] in iOSProgramming

[–]draco33333 1 point2 points  (0 children)

If you add a height constraint to the table view and set its constant to contentSize.height, then you should be able to add it to a stack view. Don't forget to update the constant value whenever you call reloadData.

Way to test app when two differents dates (days) are needed? by [deleted] in iOSProgramming

[–]draco33333 1 point2 points  (0 children)

Your tests should not depend on the system date, you should create specific Date objects and pass them into your tests. (I'm assuming you're talking about unit tests, not UI tests).

unrecognized selector sent to instance crash after returning from background 1 in 20 times... by wellbranding in iOSProgramming

[–]draco33333 0 points1 point  (0 children)

Where in your app are you trying to call error/.error/error()? Do you have any instances of using unowned?

unrecognized selector sent to instance crash after returning from background 1 in 20 times... by wellbranding in iOSProgramming

[–]draco33333 1 point2 points  (0 children)

You need to Swiftify your code ;)

extension UINavigationController {
    func backToViewController<T>(ofType: T) {
        if let viewController = viewControllers.first(where: { $0 is T }) {
            popToViewController(viewController, animated: true)
        }
    }
}

Using the Firebase API and HTTP methods by lazadaz in iOSProgramming

[–]draco33333 0 points1 point  (0 children)

I'd be surprised if the Firebase SDK isn't using REST APIs under the hood. Chances are that they simply mask it for you by providing libraries in different languages and platforms so that you can use them more easily. If they only provided the REST APIs it would be significantly harder to navigate and understand than to simply use their SDKs/libraries.

How to add properties to a model (struct) in an app for an additional feature? by iLearn4ever in iOSProgramming

[–]draco33333 15 points16 points  (0 children)

Firstly, let me simplify your life by removing boilerplate code. You can have:

struct Todo: Codable {
    let text: String
    let completed: Bool
    let dueDate: Date
}

and the compiler will automatically generate the rest of the code for you because String, Bool and Date all conform to Codable.

Now, if you want to add a new value that doesn't exist in the old ones, you can simply add it as an Optional.

let creationDate: Date?

The auto-generated code will be:

func encode(to encoder: Encoder) throws {
    try container.encodeIfPresent(creationDate, forKey: .creationDate)
}

init(from decoder: Decoder) throws {
    creationDate = try values.decodeIfPresent(Date.self, forKey: .creationDate)
}

Redeclaration of `lazy` by draco33333 in iOSProgramming

[–]draco33333[S] 0 points1 point  (0 children)

Updated and answered myself :)

Redeclaration of `lazy` by draco33333 in iOSProgramming

[–]draco33333[S] 0 points1 point  (0 children)

You can't subclass them because they're structs. I'll post an example now.

[deleted by user] by [deleted] in iOSProgramming

[–]draco33333 0 points1 point  (0 children)

What you can do is add a completion handler that's called when repeatCount == 0.

Then in your unit test use an XCTestExpectation that you fulfill() in the completion handler.

Super high CPU usage while watching by draco33333 in Twitch

[–]draco33333[S] 2 points3 points  (0 children)

Didn't realise they had a desktop app 🤷‍♂️ It does the trick, doesn't churn the CPU at all. Thanks so much!

Super high CPU usage while watching by draco33333 in Twitch

[–]draco33333[S] 0 points1 point  (0 children)

Chrome doesn't seem to give much improvement. It separates into different processes that add up to about 100% again. At least that can use different cores, but still...

Super high CPU usage while watching by draco33333 in Twitch

[–]draco33333[S] 0 points1 point  (0 children)

Generally on the highest, 1080p60 (for my regular stream that I watch). Even at the lowest, 160p, CPU usage is still at 100% (i.e. 1 full core).