Showing 1 of 2 files from the diff.

@@ -175,6 +175,7 @@
Loading
175 175
        let insetAmount = spacing / 2
176 176
        imageEdgeInsets = UIEdgeInsets(top: 0, left: -insetAmount, bottom: 0, right: insetAmount)
177 177
        titleEdgeInsets = UIEdgeInsets(top: 0, left: insetAmount, bottom: 0, right: -insetAmount)
178 +
        contentEdgeInsets = UIEdgeInsets(top: 0, left: insetAmount, bottom: 0, right: insetAmount)
178 179
    }
179 180
180 181
    /// SwifterSwift: Set the image to the right of the text
@@ -182,19 +183,12 @@
Loading
182 183
    /// - Parameters:
183 184
    ///   - spacing: spacing between title text and image.
184 185
    func setImageRightOfText(spacing: CGFloat) {
185 -
        // https://stackoverflow.com/questions/2451223/#7199529
186 -
        guard
187 -
            let imageSize = imageView?.image?.size,
188 -
            let text = titleLabel?.text,
189 -
            let font = titleLabel?.font else { return }
190 -
191 -
        let titleSize = text.size(withAttributes: [.font: font])
192 -
193 -
        let titleOffset = -(imageSize.width + spacing / 2)
194 -
        titleEdgeInsets = UIEdgeInsets(top: 0, left: titleOffset, bottom: 0, right: -titleOffset)
186 +
        semanticContentAttribute = .forceRightToLeft
195 187
196 -
        let imageOffset = -(titleSize.width + spacing / 2)
197 -
        imageEdgeInsets = UIEdgeInsets(top: 0, left: -imageOffset, bottom: 0, right: imageOffset)
188 +
        let insetAmount = spacing / 2
189 +
        imageEdgeInsets = UIEdgeInsets(top: 0, left: insetAmount, bottom: 0, right: -insetAmount)
190 +
        titleEdgeInsets = UIEdgeInsets(top: 0, left: -insetAmount, bottom: 0, right: insetAmount)
191 +
        contentEdgeInsets = UIEdgeInsets(top: 0, left: insetAmount, bottom: 0, right: insetAmount)
198 192
    }
199 193
200 194
    /// SwifterSwift: Set the image above the text
@@ -214,6 +208,9 @@
Loading
214 208
215 209
        let imageOffset = -(titleSize.height + spacing)
216 210
        imageEdgeInsets = UIEdgeInsets(top: imageOffset, left: 0.0, bottom: 0.0, right: -titleSize.width)
211 +
212 +
        let verticalInsets = (min(imageSize.height, titleSize.height) + spacing) / 2
213 +
        contentEdgeInsets = UIEdgeInsets(top: verticalInsets, left: 0.0, bottom: verticalInsets, right: 0.0)
217 214
    }
218 215
219 216
    /// SwifterSwift: Set the image below the text
@@ -233,6 +230,9 @@
Loading
233 230
234 231
        let imageOffset = -(titleSize.height + spacing)
235 232
        imageEdgeInsets = UIEdgeInsets(top: 0.0, left: 0.0, bottom: imageOffset, right: -titleSize.width)
233 +
234 +
        let verticalInsets = (min(imageSize.height, titleSize.height) + spacing) / 2
235 +
        contentEdgeInsets = UIEdgeInsets(top: verticalInsets, left: 0.0, bottom: verticalInsets, right: 0.0)
236 236
    }
237 237
}
238 238
Files Coverage
Sources/SwifterSwift 92.87%
Project Totals (100 files) 92.87%
1
codecov:
2
  token: 9c92b00a-43e8-4dd3-b455-196052f16f86
3

4
coverage:
5
  precision: 2
6
  round: down
7
  range: 70...100
8

9
  status:
10
    project: true
11
    patch: true
12
    changes: true
13

14
  ignore:
15
    - "Sources/SwifterSwift/Deprecated/*"
16
    - "Sources/SwifterSwift/*/Deprecated/*"
17
    - "Tests/**/*"
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading