Skip to content

Instantly share code, notes, and snippets.

@don1138
Last active July 18, 2024 21:29
Show Gist options
  • Select an option

  • Save don1138/697f5fd271a06df4cabbbfb4e12f0157 to your computer and use it in GitHub Desktop.

Select an option

Save don1138/697f5fd271a06df4cabbbfb4e12f0157 to your computer and use it in GitHub Desktop.

Revisions

  1. don1138 renamed this gist Sep 23, 2020. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. don1138 revised this gist Sep 23, 2020. No changes.
  3. don1138 revised this gist Sep 13, 2020. No changes.
  4. don1138 revised this gist Sep 13, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion set-relative-width.swift
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    // Get screen width and subtract Safe Area margins
    var containerWidth:CGFloat = UIScreen.main.bounds.width - 32.0

    // Set Frame Width of each column using (containerWidth * percentage)
    // Set frame width of each column using (containerWidth * percentage)
    HStack (spacing:0) {
    HStack {
    Text("Column 25% Width")
  5. don1138 revised this gist Sep 13, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion set-relative-width.swift
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    // Get screen width and subtract Safe Area margins
    var containerWidth:CGFloat = UIScreen.main.bounds.width - 32.0

    // Set Frame Width of each Columns using (containerWidth * percentage)
    // Set Frame Width of each column using (containerWidth * percentage)
    HStack (spacing:0) {
    HStack {
    Text("Column 25% Width")
  6. don1138 revised this gist Sep 13, 2020. 1 changed file with 0 additions and 2 deletions.
    2 changes: 0 additions & 2 deletions set-relative-width.swift
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,7 @@
    // Get screen width and subtract Safe Area margins

    var containerWidth:CGFloat = UIScreen.main.bounds.width - 32.0

    // Set Frame Width of each Columns using (containerWidth * percentage)

    HStack (spacing:0) {
    HStack {
    Text("Column 25% Width")
  7. don1138 created this gist Sep 13, 2020.
    20 changes: 20 additions & 0 deletions set-relative-width.swift
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    // Get screen width and subtract Safe Area margins

    var containerWidth:CGFloat = UIScreen.main.bounds.width - 32.0

    // Set Frame Width of each Columns using (containerWidth * percentage)

    HStack (spacing:0) {
    HStack {
    Text("Column 25% Width")
    }
    .frame(width: containerWidth * 0.25)
    HStack {
    Text("Column 25% Width")
    }
    .frame(width: containerWidth * 0.25)
    HStack {
    Text("Column 50% Width")
    }
    .frame(width: containerWidth * 0.5)
    }