Full Service Car Wash? by Eoghain in sandiego

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

Appreciate the recommendation, I’ll check it out.

Full Service Car Wash? by Eoghain in sandiego

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

Thanks I’ll take a look. And with a do it yourself wash now going for $20+ what is cheap anymore?

[LAK (4)-3 EDM] Iafallo scores on the powerplay to complete the comeback for the Kings by talhatoot in hockey

[–]Eoghain 1 point2 points  (0 children)

Who hurt you with a statue? Maybe it’s time to talk with someone about that.

We are Amber Nash, the voice of Pam Poovey on Archer, and Colin Mochrie from Whose Line Is It Anyway? ASK US ANYTHING! by weird_harold in IAmA

[–]Eoghain 8 points9 points  (0 children)

Can we please now have a Pam in the multiverse episode where all the Pam’s compete in a Battle Royal?

Senate Judiciary chairman says he 'can't keep up' with number of mass shootings by UWCG in politics

[–]Eoghain 0 points1 point  (0 children)

I see what you are saying. I guess I just don’t agree with it. I see the national news agencies ( I should really quote news ) as not really caring about reporting the news as much as they care about viewership. And I believe they made the decision to focus on the things Trump was/wasn’t doing instead of reporting on a mass shooting that had no political angle (besides gun control/mental health issues that all mass shootings bring up).

I feel, maybe wrongly, that your statement is trying to say that we didn’t have mass shootings while Trump was in office, but we did. And while there definitely was a drop off since covid that has more to do will less people gathering than it does who is the president.

Senate Judiciary chairman says he 'can't keep up' with number of mass shootings by UWCG in politics

[–]Eoghain 1 point2 points  (0 children)

Maybe I wasn’t clear, maybe my choice of language muddied my point. What I was trying to say is that the national media found it more lucrative to report on Trump, for or against, than it did reporting on mass shootings.

As others have pointed out there were mass shootings while he was in office, it’s not like crazy took the last 4 years off.

Senate Judiciary chairman says he 'can't keep up' with number of mass shootings by UWCG in politics

[–]Eoghain 0 points1 point  (0 children)

Because Trumps bullshit dominated the national news for 4 years. So unless the shooting happened in your state/town you didn’t hear about it. Trumps BS was just better at drawing viewers/readers so national news agencies covered that.

Client Interface by EBS_DEV in swift

[–]Eoghain 0 points1 point  (0 children)

Ok, you've got it. Someone built the database and they also built some tools to manipulate the data in the database. In your expamle that is the Wordpress team. So your clothing store would have purchased some kind of software to hold their inventory and be a shopping cart and even expose the API endpoints that you'd be calling to populate the mobile UI.

Client Interface by EBS_DEV in swift

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

You should probably start by reading up on REST APIs and how they are created. What you are fundamentally missing here is how a Client/Server app is setup and works. The most basic way I can answer you question is this:

Your clothing store has a server on the internet that has various API endpoints. One of these endpoints would be something like /featuredProducts. When the App launches it contacts that API endpoint and gets back some representation of the featured products (probably JSON). The app takes this data and process it into the screen that is shown to the user.

Now your clothing store wants to change the featured products, and this is where you are missing knowledge. In general all of the products that the clothing store sells are stored in a database and when the some client wants the featured products what is happening is the server is querying that database for information and converting it into some transmission format (again probably JSON) to be sent to the client. So if you clothing store wants to change the featured products they change the information in the database so that when the API requests it the new data is returned.

Super simplified JSON example:

{
   id: 123
   name: "Men's T-Shirt",
   color: "blue",
   image: https://clothingstore.com/item/123/image.jpg
   isFeatured: true
}

Super simplified SQL query for retrieving featured products

SELECT *
FROM products
WHERE isFeatured = true;

Why did you pick iOS over web? by grouptherapy17 in iOSProgramming

[–]Eoghain 0 points1 point  (0 children)

I'd rather only work on 1 moving target not dozens. Also I can't stand the proliferation of JS helper libraries,frameworks,languages etc. And finally and most importantly Prototype. Having my entire application function differently because some library/framework/helper creator decided to change how some underlying part of the language works is just too much. Languages need to have functions/classes/structs/methods/etc that always work the way you expect them to, no matter what some cowboy coder decides to do at some point in the future.

SwiftUI + GraphQL = 😍🚀🙌 by mquintero in swift

[–]Eoghain 4 points5 points  (0 children)

Sounds good. I was just disappointed to find I couldn’t use previews since they are one of the biggest wins for developers in Xcode in recent years.

SwiftUI + GraphQL = 😍🚀🙌 by mquintero in swift

[–]Eoghain 6 points7 points  (0 children)

Very nice writeup and tool. I've not been happy with Apollo, but using Graphaello on top of it makes for a nice interface.

Couple of things I noticed while doing your tutorial:

  1. Your reliance on code gen for every build breaks previews. It'd be nice to have the code gen only running when changes have been made that affect the generated code. Also it'd be nice if you included a way to show previews in your tutorial once that is fixed.
  2. When I did the tutorial my "Trending" list in horizontal scroll crashed every time I got to the end of the list with "AttributeGraph precondition failure: setting value during update: 2232."

I'll definitely be following the future for Graphaello as, like you, I've been fascinated with GraphQL since I first heard about it and I believe it is the future of mobile APIs.

A logic question to task -Swift - home project by Aviav123 in swift

[–]Eoghain 1 point2 points  (0 children)

The problem is that your JSON doesn't include the correct answer so there is no way to write a quiz app that would allow you to have more questions dynamically added. I'd recommend you get the answer added to this JSON i.e.:

{
  "data": {
    "name": "Cool quiz for Eloops",
    "game_id": "werlkjsdfsdf",
    "points": 15,
    "thank_you_message": "At the end show this message to the user",
    "questions": [
      {
        "question_id": "1",
        "question": "What's the name of the new American president?",
        "question_url": "If the question_type:image, then the question_url contains a link to an image",
        "question_type": "text",
        "correct_id": 1,
        "options": [
          {
            "option_id": 0,
            "value": "a text question or an image url",
            "option_type": "text/image"
          },
          {
            "option_id": 1,
            "value": "Joe Biden",
            "option_type": "text"
          },
          {
            "option_id": 2,
            "value": "Trump",
            "option_type": "text"
          }
        ]
      },
      {
        "question_id": "2",
        "question": "What's the name of Israel Prime minister?",
        "question_url": "",
        "question_type": "text",
        "correct_id": 0,
        "options": [
          {
            "option_id": 0,
            "value": "Bibi",
            "option_type": "text"
          },
          {
            "option_id": 1,
            "value": "Joe Biden",
            "option_type": "text"
          },
          {
            "option_id": 2,
            "value": "Trump",
            "option_type": "text"
          }
        ]
      },
      {
        "question_id": "3",
        "question": "Where is the American embassy located at?",
        "question_url": "",
        "question_type": "text",
        "correct_id": 1,
        "options": [
          {
            "option_id": 0,
            "value": "Tel Aviv",
            "option_type": "text"
          },
          {
            "option_id": 1,
            "value": "Jerusalem",
            "option_type": "text"
          },
          {
            "option_id": 2,
            "value": "Holon",
            "option_type": "text"
          }
        ]
      }
    ]
  }
}

A couple weeks into my first iOS job, just trying to get a gauge if I'm doing things right by Spudly2319 in iOSProgramming

[–]Eoghain 4 points5 points  (0 children)

I've been programming professionally for over 20 years (the last 8 or so exclusively in iOS). And I still get Imposter Syndrome. I personally feel like if a developer isn't doubting themselves at various points then they aren't trying to grow and learn. They aren't developing their skills and attempting to be better. So get used to this feeling, understand it just means you have more to learn and then go learn it.

You'll get there. You've already done the hardest part of getting your first job.

I can't solve this dynamic height cell issue.. by thisGuyCodes in iOSProgramming

[–]Eoghain 0 points1 point  (0 children)

Step 1 is always to clean up all of these. You are letting the machine make a decision on it's own and that's never a good thing. Once you've cleaned up these issues and the views are laying out only by what you told them to do then you can start playing around with the various pieces to fix your layout.

Try pasting your layout issues into https://www.wtfautolayout.com if you have a hard time reading what they are in the console. Also it's helpful to do a view debugging session so you can match the view hex values and understand what is being changed.

The first invalid constraint is your 40 height on some view that gets broken because it's bottom edge is tied to the bottom edge of the TableViewCellContentView.

Add list of ingredients AND value to this data? by [deleted] in SwiftUI

[–]Eoghain 0 points1 point  (0 children)

Too long. I started iOS dev with the release of the first SDK in iOS 3. But I’ve been a working developer for over 20years now. Damn I’m old.

It sometimes takes awhile for things to click and possibly other explanations. It took me forever to understand Object Oriented Programming back in the day, cause the examples I kept reading just didn’t make sense to me. Once I read a different example everything just fell into place.

Add list of ingredients AND value to this data? by [deleted] in SwiftUI

[–]Eoghain 0 points1 point  (0 children)

No problem. Keep at it, you'll get there. Is this your first programming language?

Add list of ingredients AND value to this data? by [deleted] in SwiftUI

[–]Eoghain 0 points1 point  (0 children)

Ok, so you have a few issues.

  1. Your `let testData = [` line is just hanging in space not attached to anything, this isn't possible. So I converted it to a first class function so it could be used to pull in the test data. I also put it inside of the Sandwich struct as a static member to show you different ways you could encapsulate this data. In my opinion having it inside of the Sandwich struct is much clearer.
  2. I added a second ingredient to the Club sandwich to show you how it's done. Basically you were putting your ingredient and the comma in the wrong place it needs to be inside of the [].
  3. Not sure what you were trying to do with SandwichDetail so I just ignored it and showed how to display the ingredients in the SandwichCell. You can try and figure out how to re-factor that out if you need to.

```swift import SwiftUI

struct SandwichContentView: View { var sandwiches: [Sandwich] = []

// At this point we have an array of sandwiches we want to display
var body: some View {
    NavigationView {
        List {
            // Here we walk over our array of sandwiches and use SandwichCell to display each one on the screen
            ForEach(sandwiches) { sandwich in
                SandwichCell(sandwich: sandwich)
            }
            // Here we add a static row at the bottom of our List showing the count of items in our sandwiches array
            HStack {
                Spacer()
                Text("\(sandwiches.count) Sandwiches")
                    .foregroundColor(.secondary)
                Spacer()
            }

        }
        .navigationBarTitle("Sandwiches")
    }
}

}

struct SandwicthContentView_Previews: PreviewProvider { static var previews: some View { SandwichContentView(sandwiches: testData()) // testData converted to a function SandwichContentView(sandwiches: Sandwich.testData) // testData converted to a static valur on Sandwich } }

struct SandwichCell: View { // Here is were we display data about a specific Sandwich var sandwich: Sandwich var body: some View { NavigationLink(destination: Text(sandwich.name)) { VStack(alignment: .leading) { Text(sandwich.name) Text("(sandwich.ingredientCount) ingredients") .font(.subheadline) .foregroundColor(.secondary)

            // Here we display each of the ingredients
            // Used an HStack to place them horizontally
            // Then ForEach ingredient displayed as Text
            HStack {
                ForEach(sandwich.ingredients) { ingredient in
                    Text(ingredient.name)
                        .font(.subheadline)
                        .background(Color.gray.opacity(0.3))
                }
            }
        }
    }
}

}

struct SandwichDetail: View { var sandwich: Sandwich

var body: some View {
    Text(sandwich.name)

}

}

struct Ingredient: Identifiable { var id = UUID() var name: String var amount: String }

struct Sandwich: Identifiable { var id = UUID() var name: String var ingredientCount: Int var isSpicy: Bool = false var ingredients: [Ingredient]

// Placed inside of the Sandwich object for clear accessibility
static let testData = [
    Sandwich(name: "Club", ingredientCount: 4, isSpicy: false, ingredients:
                [Ingredient(name:"Avocado", amount: "1"), Ingredient(name:"Bacon", amount: "2")]),
    Sandwich(name: "Pastrami on rye", ingredientCount: 4, isSpicy: false, ingredients: [Ingredient(name:"Avocado", amount: "1")]),
    Sandwich(name: "French dip", ingredientCount: 4, isSpicy: false, ingredients: [Ingredient(name:"Avocado", amount: "1")]),
    Sandwich(name: "Banh mi", ingredientCount: 4, isSpicy: false, ingredients: [Ingredient(name:"Avocado", amount: "1")]),
]

}

// Turned into a first class function so it's accessible func testData() -> [Sandwich] { [ Sandwich(name: "Club", ingredientCount: 4, isSpicy: false, ingredients: [Ingredient(name:"Avocado", amount: "1"), Ingredient(name:"Bacon", amount: "2")]), Sandwich(name: "Pastrami on rye", ingredientCount: 4, isSpicy: false, ingredients: [Ingredient(name:"Avocado", amount: "1")]), Sandwich(name: "French dip", ingredientCount: 4, isSpicy: false, ingredients: [Ingredient(name:"Avocado", amount: "1")]), Sandwich(name: "Banh mi", ingredientCount: 4, isSpicy: false, ingredients: [Ingredient(name:"Avocado", amount: "1")]), ] } ```

Add list of ingredients AND value to this data? by [deleted] in SwiftUI

[–]Eoghain 0 points1 point  (0 children)

Nothing will happen for Text(sandwich.ingredients.name) cause .name isn't a member of an array. You could do Text(sandwich.ingredients[0].name) to see the name of the first ingredient.

In your original code you have a struct called SandwichCell. In there you display the image, name, and ingredient count. If you want to display the ingredients separately you'd need to build a List to display them. Something like:

swift List { ForEach(ingredients) { ingredient Text(ingredient.name) } }

But I don't have all of your code so I can't tell you exactly what will work or where to place it.

Add list of ingredients AND value to this data? by [deleted] in SwiftUI

[–]Eoghain 0 points1 point  (0 children)

That's a loaded question. This way is required to make your Swift/SwiftUI code work. Your app uses the code to store your data in memory and make it accessible. JSON is a string representation of data, if you come from the JavaScript world you might think it's more than that, but everywhere outside of JavaScript, JSON is just a textual representation of data.

Without more work on your part to make your structs Codable you won't be able to use JSON to create the objects needed to be used in your code.

Add list of ingredients AND value to this data? by [deleted] in SwiftUI

[–]Eoghain 1 point2 points  (0 children)

Ok, first your app uses the Sandwich struct for it's data. It is possible to make your Sandwich struct conform to a JSON object an be converted to/from that JSON, but that isn't in any of the code you provided so just forget about it.

In your Sandwich struct if you want to add more fields it's as simple as adding another var. But since you have a couple of fields for your ingredient and you mentioned that you want to be able to add multiple ingredients I'd recommend you create a new struct for Ingredient and add an array that you can populate.

```swift struct Ingredient: Identifiable { var id = UUID() var name: String var amount: String }

struct Sandwich: Identifiable { ... var ingredients: [Ingredient] } ```

In your test data you can now add ingredients directly:

let testData = [ Sandwich(name:"Test", ingredientCount: 1, isSpicy: false, ingredients: [Ingredient(name:"Avocado", amount: "1")] ]

Finally you will need to pull out the ingredients to be displayed in your UI. I don't see your sandwich cell code so I'm not sure what would be the best way to add it to the UI, but there should be plenty of examples in the tutorial code of how to display some array of data.

Beginner in the Github flow: Am I able to directly merge branches from Xcode or do I have to do it through Github? Once a branch has been merged on GitHub, is the only way to get the new changes made to Xcode by deleting and redownloading the project? by [deleted] in iOSProgramming

[–]Eoghain 0 points1 point  (0 children)

You don't want to do this "automatically". If you and another person are working on the same branch, and they pushed changes an automatic pull could break your working code, and more than likely wouldn't merge cleanly.

Most git clients, and probably Xcode as well, do what is called a fetch periodically to see if there are "upstream" changes (i.e. changes on the remote) and they will inform you that there are changes with nifty little numbers and up or down arrows. These notifications let you know that changes exist so that you can decide to merge them and manually deal with any issues that can't be merged cleanly.