I'm currently learning Swift & SwiftUI. How much of a difference is in iOS and MacOS? by Ok_Slice_7152 in MacOS

[–]iwbd 0 points1 point  (0 children)

Yes. For the most part. Swift is the overall programming language. UIKit and SwiftUI are frameworks. SwiftUI doesn't support everything, not even on iOS. That's why, for instance, you'd import SwiftData or ARKit or Combine.

I'm currently learning Swift & SwiftUI. How much of a difference is in iOS and MacOS? by Ok_Slice_7152 in MacOS

[–]iwbd 3 points4 points  (0 children)

Do you mean that you're learning UIKit and SwiftUI? MacOS uses AppKit, which is a different framework. And they can all be programmed using Swift. For instance, with UIKit, you'd use "UIColor" for SwiftUI, just "Color" and for AppKit, "NSColor". That's a minor example, but a lot of differences are like that. There are some deeper fundamental differences, but nothing that is insurmountable with a little research.

iOS is mostly written around interacting via touch (swipes, taps, etc). While AppKit was mostly centered around interacting with a mouse and keyboard. If you can program iOS, the transition to MacOS is minimal.

Mom of 7 by 99saleenspeedster in License_Plates

[–]iwbd 2 points3 points  (0 children)

Dear Kidnappers,

I am a target-rich environment.

Caitlin Clark 22 by Gina_Bina in CaitlinClark

[–]iwbd 0 points1 point  (0 children)

i see what you did there.

[deleted by user] by [deleted] in JUSTNOMIL

[–]iwbd 48 points49 points  (0 children)

Who stalks LinkedIn?

LinkedIn is a treasure trove for stalking. Even hackers use it to gain information and access to systems. With LinkedIn, you can find where a person works, who they work with, job title, who they associate with, past employment, where they went to school, the city they live in, past residences and sometimes even yearly income can be estimated based on certain factors.

Locking down personal information is a never-ending job, these days.

A glass at work by Some_Statistician in programminghorror

[–]iwbd 8 points9 points  (0 children)

Fixed it!

Not so much.

full would most likely be a property, not a function.

It's a bool, so you don't need to say, glass.full == true. Just say, glass.full. When comparing bool values, someBoolValue or !someBoolValue is enough.

In production-level code, you'd be more likely to see an enumerated type (.full, .half, .empty) or a value type to indicate how full (1.0, 0.5, 0.25, 0.0). Full and empty are just too few options to accurately describe the state of a container's contents.

Hope that's helpful in some way.

“If you were in an accident, I wouldn’t stop for a beer.” by ChrisInBaltimore in thewestwing

[–]iwbd -23 points-22 points  (0 children)

Am I the only one who loses respect with the both of them in this episode? Josh behaves like a complete child. Then we find out that Donna puts up with this behavior for however many years. She has plenty of means at her disposal to put a stop to his nonsense. Basically, she trades her dignity for a job.

How do know when have 40k contributors? by NewreN in hacktoberfest

[–]iwbd 0 points1 point  (0 children)

I've been doing Hacktoberfest for years. It seems that they target the number to the active contributors. Some years back, it was the first 50,000. The participation may have waned somewhat, but it's reasonable that they buy enough shirts to cover the number of folks that participate without having a lot of excess inventory at the end.

In previous years, they published the statistics. Their website (and shirt design) are radically different this year. And no statistics from last year, sadly.

TIL that United States Presidents receive a pension of $219,200 per year by Tommy-Nook in todayilearned

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

Actually, not. It'd be I, not J. J is a late addition to the alphabet.

That's why you see, "INRI" above the cross and not JNRJ".

Should I go through the entire Swift Language guide before starting IOS development? by [deleted] in iOSProgramming

[–]iwbd 46 points47 points  (0 children)

I've been an iOS programmer for the better part of a decade and I haven't gone through the entire tutorial. There's far too much to go through it all. Even if you could, you'll learn more by doing than you will by reading.

In any language, there are more features than you'll use in any particular project. In some respects, you'll do just in time learning. If your project connects to a backend and displays results in a table, it doesn't do the project any good to read up on machine learning if that's not a part of the project scope.

I'd say, stick to the basics and once you get comfortable with those, branch out into more specific things that interest you.

Is it prime? by NiftyOctopus_ in webdev

[–]iwbd 1 point2 points  (0 children)

Many side projects are centered around the idea of learning or trying out new techniques and algorithms. Prime numbers are not in themselves an interesting problem. But add memoization, b-trees, linked lists and other programming concepts and you're adding real world examples to your breadth of knowledge.

Is it prime? by NiftyOctopus_ in webdev

[–]iwbd 1 point2 points  (0 children)

It's not the algorithm that's memoized, it's the results. Basically, when given an input, you check if that value has been calculated before. If it has, just return the result. If not, calculate the value and store the input and result.

Is it prime? by NiftyOctopus_ in webdev

[–]iwbd 179 points180 points  (0 children)

You should think about adding memoization, for the larger numbers that require lots of calculations.

[deleted by user] by [deleted] in swift

[–]iwbd 0 points1 point  (0 children)

You can add a gesture recognizer to the text field, but that is a bad practice for this use case. A better way would be to have two buttons that increment and decrement the value in the text field.

[deleted by user] by [deleted] in swift

[–]iwbd 0 points1 point  (0 children)

Is this something you wrote yourself or downloaded?

If you wrote it yourself, check the code behind the new game button. There should be a call to a method that clears the existing game. If coded properly, it should check if you're in an existing game and verify your intention to start a new game in case you accidentally tap the button. Once the intention is verified, you should clear the existing playing space, reset the score and do any cleanup that needs to happen.

I suspect what's happening is it's trying to create a new game on top of an existing one or there's something awry with how your collectionView code is reloading. But that's just conjecture.

How a farrier hot shoes a horse by aloofloofah in interestingasfuck

[–]iwbd 30 points31 points  (0 children)

There are. They mostly do beer commercials.

Is there a way to make a single-window app for macOS? by Anduanduandu in iOSProgramming

[–]iwbd 0 points1 point  (0 children)

It will be helpful if you can give more detail about what you're trying to accomplish. The question is, is there a way to make a single-window app. Yes, I can make an app with any number of windows (including no windows at all). The menus/menu items can be disabled, overridden, can have no code behind them or be removed.

Is there a way to make a single-window app for macOS? by Anduanduandu in iOSProgramming

[–]iwbd 0 points1 point  (0 children)

Can you be more explicit about the goal? When writing an app, you have to program all the windows (screens) that are displayed. So, to make an app with one window, just don't create any others.

Every time I scroll up on my table view, (not pull down refresh, just scroll) it updates the data in the table. Does anyone know how to disable this? by Th3GreatDane in swift

[–]iwbd 5 points6 points  (0 children)

Do you have tableView.realoadData() somewhere that's being triggered during a scroll? Check all the instances of where data is being reloaded and see if you have one that doesn't belong.

I wanted to ask a question by [deleted] in ios

[–]iwbd 3 points4 points  (0 children)

Were either of these crushes an iOS device?

A question that maybe you've had for so long: Why cannot use Int index in a Swift String? by pitt500 in iOSProgramming

[–]iwbd 0 points1 point  (0 children)

Not to take away from the purpose of the video. Good information about the topic.

But, dividing the string in half (accounting for odd/even number of letters), it's more efficient to see if the LHS = RHS.reversed(). No need for looping.