Skip to content

Commit

Permalink
Public release 1.1.7.
Browse files Browse the repository at this point in the history
Public release 1.1.7.
  • Loading branch information
dmytrokhl authored Sep 8, 2023
2 parents d12ca31 + be0a776 commit 12fd911
Show file tree
Hide file tree
Showing 65 changed files with 215 additions and 92 deletions.
18 changes: 18 additions & 0 deletions Sources/VGSShowSDK/UIElements/VGSLabel/VGSLabel+Internal.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,24 @@ internal extension VGSLabel {
NSLayoutConstraint.activate(verticalConstraint)
self.layoutIfNeeded()
}

/// Calculate VGSLabel IntrinsicContentSize
/// - NOTE: we have two labels: text label and placeholder label
func getIntrinsicContentSize() -> CGSize {
/// If label is hidden, return placeholder label size
let txtSize: CGSize
/// check if placeholder visible
if label.isHidden {
txtSize = placeholderLabel.intrinsicContentSize
} else {
/// Find max size
txtSize = label.intrinsicContentSize.width >= placeholderLabel.intrinsicContentSize.width ? label.intrinsicContentSize : placeholderLabel.intrinsicContentSize
}
/// Add paddings
let width = txtSize.width + paddings.left + paddings.right
let height = txtSize.height + paddings.bottom + paddings.top
return CGSize(width: width, height: height)
}

func setPlaceholderPaddings() {
var placeholderPaddings = paddings
Expand Down
5 changes: 5 additions & 0 deletions Sources/VGSShowSDK/UIElements/VGSLabel/VGSLabel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,11 @@ public final class VGSLabel: UIView, VGSLabelProtocol {
public var placeholderPaddings: UIEdgeInsets? = nil {
didSet { setPlaceholderPaddings() }
}

/// The natural size for the Lbel, considering only properties of the view itself.
public override var intrinsicContentSize: CGSize {
return getIntrinsicContentSize()
}

// MARK: - Accessibility Attributes
/// A succinct label in a localized string that
Expand Down
12 changes: 12 additions & 0 deletions Sources/VGSShowSDK/UIElements/VGSMaskedLabel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,16 @@ internal class VGSMaskedLabel: VGSAttributedLabel {
}
}
}

/// The natural size for the Lbel, considering only properties of the view itself.
override var intrinsicContentSize: CGSize {
return getIntrinsicContentSize()
}

/// Calculate internal label IntrinsicContentSize
func getIntrinsicContentSize() -> CGSize {
/// Get formatted text from label
guard let txt = secureAttributedText else { return super.intrinsicContentSize }
return self.computeTextSize(for: txt)
}
}
28 changes: 28 additions & 0 deletions Sources/VGSShowSDK/UIElements/VGSPlaceholderLabel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,32 @@ internal class VGSAttributedLabel: UILabel {
}
get { return super.text }
}

/// The natural size for the Lbel, considering only properties of the view itself.
override var intrinsicContentSize: CGSize {
guard let txt = text else { return super.intrinsicContentSize }
return computeTextSize(for: txt)
}

/// Calculate intrinsicContentSize for String
func computeTextSize(for text: String) -> CGSize {
// Use the font of the label for the calculation, fall back to system font if not set
let fontToUse = font ?? UIFont.systemFont(ofSize: UIFont.systemFontSize)

let textAttributes: [NSAttributedString.Key: Any] = [.font: fontToUse]
let boundingBox = text.boundingRect(with: CGSize(width: CGFloat.greatestFiniteMagnitude, height: CGFloat.greatestFiniteMagnitude),
options: [.usesLineFragmentOrigin, .usesFontLeading],
attributes: textAttributes,
context: nil)

return CGSize(width: ceil(boundingBox.width), height: ceil(boundingBox.height))
}

/// Calculate intrinsicContentSize for NSAttributedString
func computeTextSize(for attributedText: NSAttributedString) -> CGSize {
let boundingBox = attributedText.boundingRect(with: CGSize(width: CGFloat.greatestFiniteMagnitude, height: CGFloat.greatestFiniteMagnitude),
options: [.usesLineFragmentOrigin, .usesFontLeading],
context: nil)
return CGSize(width: ceil(boundingBox.width), height: ceil(boundingBox.height))
}
}
2 changes: 1 addition & 1 deletion Sources/VGSShowSDK/Utils/Helpers/VGSUtils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ internal class Utils {

/// VGS Show SDK Version.
/// Necessary since SPM doesn't track info plist correctly: https://forums.swift.org/t/add-info-plist-on-spm-bundle/40274/5
static let vgsShowVersion = "1.1.6"
static let vgsShowVersion = "1.1.7"
}
2 changes: 1 addition & 1 deletion VGSShowSDK.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |spec|
spec.name = "VGSShowSDK"
spec.version = "1.1.6"
spec.version = "1.1.7"
spec.summary = "VGS Show - is a product suite that allows customers to reveal and show information securely without possession of it."
spec.swift_version = '5.0'
spec.description = <<-DESC
Expand Down
4 changes: 2 additions & 2 deletions VGSShowSDK.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1117,7 +1117,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 1.1.6;
MARKETING_VERSION = 1.1.7;
PRODUCT_BUNDLE_IDENTIFIER = com.vgs.framework.VGSShowsSDK;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
Expand Down Expand Up @@ -1148,7 +1148,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 1.1.6;
MARKETING_VERSION = 1.1.7;
PRODUCT_BUNDLE_IDENTIFIER = com.vgs.framework.VGSShowsSDK;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
Expand Down
4 changes: 2 additions & 2 deletions docs/Classes.html
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ <h4>Declaration</h4>
</div>
</div>
<div class="slightly-smaller">
<a href="https://github.com/verygoodsecurity/vgs-show-ios/tree/master/Sources/VGSShowSDK/UIElements/VGSLabel/VGSLabel.swift#L14-L411">Show on GitHub</a>
<a href="https://github.com/verygoodsecurity/vgs-show-ios/tree/master/Sources/VGSShowSDK/UIElements/VGSLabel/VGSLabel.swift#L14-L416">Show on GitHub</a>
</div>
</section>
</div>
Expand Down Expand Up @@ -365,7 +365,7 @@ <h4>Declaration</h4>
</article>
</div>
<section class="footer">
<p>&copy; 2023 <a class="link" href="https://verygoodsecurity.com" target="_blank" rel="external noopener">Very Good Security</a>. All rights reserved. (Last updated: 2023-07-19)</p>
<p>&copy; 2023 <a class="link" href="https://verygoodsecurity.com" target="_blank" rel="external noopener">Very Good Security</a>. All rights reserved. (Last updated: 2023-09-08)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.3</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
</section>
</body>
Expand Down
2 changes: 1 addition & 1 deletion docs/Classes/VGSImageView.html
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ <h4>Declaration</h4>
</article>
</div>
<section class="footer">
<p>&copy; 2023 <a class="link" href="https://verygoodsecurity.com" target="_blank" rel="external noopener">Very Good Security</a>. All rights reserved. (Last updated: 2023-07-19)</p>
<p>&copy; 2023 <a class="link" href="https://verygoodsecurity.com" target="_blank" rel="external noopener">Very Good Security</a>. All rights reserved. (Last updated: 2023-09-08)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.3</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
</section>
</body>
Expand Down
62 changes: 46 additions & 16 deletions docs/Classes/VGSLabel.html
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ <h1>VGSLabel</h1>
<p>A view that displays revealed text data.</p>

<div class="slightly-smaller">
<a href="https://github.com/verygoodsecurity/vgs-show-ios/tree/master/Sources/VGSShowSDK/UIElements/VGSLabel/VGSLabel.swift#L14-L411">Show on GitHub</a>
<a href="https://github.com/verygoodsecurity/vgs-show-ios/tree/master/Sources/VGSShowSDK/UIElements/VGSLabel/VGSLabel.swift#L14-L416">Show on GitHub</a>
</div>
</div>
</section>
Expand Down Expand Up @@ -808,6 +808,36 @@ <h4>Declaration</h4>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/c:@M@VGSShowSDK@objc(cs)VGSLabel(py)intrinsicContentSize"></a>
<a name="//apple_ref/swift/Property/intrinsicContentSize" class="dashAnchor"></a>
<a class="token" href="#/c:@M@VGSShowSDK@objc(cs)VGSLabel(py)intrinsicContentSize">intrinsicContentSize</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The natural size for the Lbel, considering only properties of the view itself.</p>

</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">override</span> <span class="k">var</span> <span class="nv">intrinsicContentSize</span><span class="p">:</span> <span class="kt">CGSize</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>

</div>
</div>
<div class="slightly-smaller">
<a href="https://github.com/verygoodsecurity/vgs-show-ios/tree/master/Sources/VGSShowSDK/UIElements/VGSLabel/VGSLabel.swift#L223-L225">Show on GitHub</a>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
Expand Down Expand Up @@ -847,7 +877,7 @@ <h4>Declaration</h4>
</div>
</div>
<div class="slightly-smaller">
<a href="https://github.com/verygoodsecurity/vgs-show-ios/tree/master/Sources/VGSShowSDK/UIElements/VGSLabel/VGSLabel.swift#L225-L233">Show on GitHub</a>
<a href="https://github.com/verygoodsecurity/vgs-show-ios/tree/master/Sources/VGSShowSDK/UIElements/VGSLabel/VGSLabel.swift#L230-L238">Show on GitHub</a>
</div>
</section>
</div>
Expand Down Expand Up @@ -878,7 +908,7 @@ <h4>Declaration</h4>
</div>
</div>
<div class="slightly-smaller">
<a href="https://github.com/verygoodsecurity/vgs-show-ios/tree/master/Sources/VGSShowSDK/UIElements/VGSLabel/VGSLabel.swift#L237-L245">Show on GitHub</a>
<a href="https://github.com/verygoodsecurity/vgs-show-ios/tree/master/Sources/VGSShowSDK/UIElements/VGSLabel/VGSLabel.swift#L242-L250">Show on GitHub</a>
</div>
</section>
</div>
Expand Down Expand Up @@ -909,7 +939,7 @@ <h4>Declaration</h4>
</div>
</div>
<div class="slightly-smaller">
<a href="https://github.com/verygoodsecurity/vgs-show-ios/tree/master/Sources/VGSShowSDK/UIElements/VGSLabel/VGSLabel.swift#L249-L257">Show on GitHub</a>
<a href="https://github.com/verygoodsecurity/vgs-show-ios/tree/master/Sources/VGSShowSDK/UIElements/VGSLabel/VGSLabel.swift#L254-L262">Show on GitHub</a>
</div>
</section>
</div>
Expand Down Expand Up @@ -954,7 +984,7 @@ <h4>Declaration</h4>
</div>
</div>
<div class="slightly-smaller">
<a href="https://github.com/verygoodsecurity/vgs-show-ios/tree/master/Sources/VGSShowSDK/UIElements/VGSLabel/VGSLabel.swift#L263-L271">Show on GitHub</a>
<a href="https://github.com/verygoodsecurity/vgs-show-ios/tree/master/Sources/VGSShowSDK/UIElements/VGSLabel/VGSLabel.swift#L268-L276">Show on GitHub</a>
</div>
</section>
</div>
Expand Down Expand Up @@ -985,7 +1015,7 @@ <h4>Declaration</h4>
</div>
</div>
<div class="slightly-smaller">
<a href="https://github.com/verygoodsecurity/vgs-show-ios/tree/master/Sources/VGSShowSDK/UIElements/VGSLabel/VGSLabel.swift#L275-L282">Show on GitHub</a>
<a href="https://github.com/verygoodsecurity/vgs-show-ios/tree/master/Sources/VGSShowSDK/UIElements/VGSLabel/VGSLabel.swift#L280-L287">Show on GitHub</a>
</div>
</section>
</div>
Expand Down Expand Up @@ -1015,7 +1045,7 @@ <h4>Declaration</h4>
</div>
</div>
<div class="slightly-smaller">
<a href="https://github.com/verygoodsecurity/vgs-show-ios/tree/master/Sources/VGSShowSDK/UIElements/VGSLabel/VGSLabel.swift#L285-L292">Show on GitHub</a>
<a href="https://github.com/verygoodsecurity/vgs-show-ios/tree/master/Sources/VGSShowSDK/UIElements/VGSLabel/VGSLabel.swift#L290-L297">Show on GitHub</a>
</div>
</section>
</div>
Expand Down Expand Up @@ -1045,7 +1075,7 @@ <h4>Declaration</h4>
</div>
</div>
<div class="slightly-smaller">
<a href="https://github.com/verygoodsecurity/vgs-show-ios/tree/master/Sources/VGSShowSDK/UIElements/VGSLabel/VGSLabel.swift#L295-L302">Show on GitHub</a>
<a href="https://github.com/verygoodsecurity/vgs-show-ios/tree/master/Sources/VGSShowSDK/UIElements/VGSLabel/VGSLabel.swift#L300-L307">Show on GitHub</a>
</div>
</section>
</div>
Expand Down Expand Up @@ -1075,7 +1105,7 @@ <h4>Declaration</h4>
</div>
</div>
<div class="slightly-smaller">
<a href="https://github.com/verygoodsecurity/vgs-show-ios/tree/master/Sources/VGSShowSDK/UIElements/VGSLabel/VGSLabel.swift#L305-L312">Show on GitHub</a>
<a href="https://github.com/verygoodsecurity/vgs-show-ios/tree/master/Sources/VGSShowSDK/UIElements/VGSLabel/VGSLabel.swift#L310-L317">Show on GitHub</a>
</div>
</section>
</div>
Expand Down Expand Up @@ -1105,7 +1135,7 @@ <h4>Declaration</h4>
</div>
</div>
<div class="slightly-smaller">
<a href="https://github.com/verygoodsecurity/vgs-show-ios/tree/master/Sources/VGSShowSDK/UIElements/VGSLabel/VGSLabel.swift#L315-L322">Show on GitHub</a>
<a href="https://github.com/verygoodsecurity/vgs-show-ios/tree/master/Sources/VGSShowSDK/UIElements/VGSLabel/VGSLabel.swift#L320-L327">Show on GitHub</a>
</div>
</section>
</div>
Expand Down Expand Up @@ -1135,7 +1165,7 @@ <h4>Declaration</h4>
</div>
</div>
<div class="slightly-smaller">
<a href="https://github.com/verygoodsecurity/vgs-show-ios/tree/master/Sources/VGSShowSDK/UIElements/VGSLabel/VGSLabel.swift#L325-L333">Show on GitHub</a>
<a href="https://github.com/verygoodsecurity/vgs-show-ios/tree/master/Sources/VGSShowSDK/UIElements/VGSLabel/VGSLabel.swift#L330-L338">Show on GitHub</a>
</div>
</section>
</div>
Expand Down Expand Up @@ -1165,7 +1195,7 @@ <h4>Declaration</h4>
</div>
</div>
<div class="slightly-smaller">
<a href="https://github.com/verygoodsecurity/vgs-show-ios/tree/master/Sources/VGSShowSDK/UIElements/VGSLabel/VGSLabel.swift#L336-L343">Show on GitHub</a>
<a href="https://github.com/verygoodsecurity/vgs-show-ios/tree/master/Sources/VGSShowSDK/UIElements/VGSLabel/VGSLabel.swift#L341-L348">Show on GitHub</a>
</div>
</section>
</div>
Expand Down Expand Up @@ -1195,7 +1225,7 @@ <h4>Declaration</h4>
</div>
</div>
<div class="slightly-smaller">
<a href="https://github.com/verygoodsecurity/vgs-show-ios/tree/master/Sources/VGSShowSDK/UIElements/VGSLabel/VGSLabel.swift#L346-L356">Show on GitHub</a>
<a href="https://github.com/verygoodsecurity/vgs-show-ios/tree/master/Sources/VGSShowSDK/UIElements/VGSLabel/VGSLabel.swift#L351-L361">Show on GitHub</a>
</div>
</section>
</div>
Expand Down Expand Up @@ -1238,7 +1268,7 @@ <h4>Declaration</h4>
</div>
</div>
<div class="slightly-smaller">
<a href="https://github.com/verygoodsecurity/vgs-show-ios/tree/master/Sources/VGSShowSDK/UIElements/VGSLabel/VGSLabel.swift#L361-L368">Show on GitHub</a>
<a href="https://github.com/verygoodsecurity/vgs-show-ios/tree/master/Sources/VGSShowSDK/UIElements/VGSLabel/VGSLabel.swift#L366-L373">Show on GitHub</a>
</div>
</section>
</div>
Expand Down Expand Up @@ -1268,7 +1298,7 @@ <h4>Declaration</h4>
</div>
</div>
<div class="slightly-smaller">
<a href="https://github.com/verygoodsecurity/vgs-show-ios/tree/master/Sources/VGSShowSDK/UIElements/VGSLabel/VGSLabel.swift#L371-L378">Show on GitHub</a>
<a href="https://github.com/verygoodsecurity/vgs-show-ios/tree/master/Sources/VGSShowSDK/UIElements/VGSLabel/VGSLabel.swift#L376-L383">Show on GitHub</a>
</div>
</section>
</div>
Expand All @@ -1281,7 +1311,7 @@ <h4>Declaration</h4>
</article>
</div>
<section class="footer">
<p>&copy; 2023 <a class="link" href="https://verygoodsecurity.com" target="_blank" rel="external noopener">Very Good Security</a>. All rights reserved. (Last updated: 2023-07-19)</p>
<p>&copy; 2023 <a class="link" href="https://verygoodsecurity.com" target="_blank" rel="external noopener">Very Good Security</a>. All rights reserved. (Last updated: 2023-09-08)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.3</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
</section>
</body>
Expand Down
2 changes: 1 addition & 1 deletion docs/Classes/VGSLabel/CopyTextFormat.html
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ <h4>Declaration</h4>
</article>
</div>
<section class="footer">
<p>&copy; 2023 <a class="link" href="https://verygoodsecurity.com" target="_blank" rel="external noopener">Very Good Security</a>. All rights reserved. (Last updated: 2023-07-19)</p>
<p>&copy; 2023 <a class="link" href="https://verygoodsecurity.com" target="_blank" rel="external noopener">Very Good Security</a>. All rights reserved. (Last updated: 2023-09-08)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.3</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
</section>
</body>
Expand Down
2 changes: 1 addition & 1 deletion docs/Classes/VGSLogger.html
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ <h4>Declaration</h4>
</article>
</div>
<section class="footer">
<p>&copy; 2023 <a class="link" href="https://verygoodsecurity.com" target="_blank" rel="external noopener">Very Good Security</a>. All rights reserved. (Last updated: 2023-07-19)</p>
<p>&copy; 2023 <a class="link" href="https://verygoodsecurity.com" target="_blank" rel="external noopener">Very Good Security</a>. All rights reserved. (Last updated: 2023-09-08)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.3</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
</section>
</body>
Expand Down
Loading

0 comments on commit 12fd911

Please sign in to comment.