Swift – AlbeBaubles https://albebaubles.com Mobile & IoT Development Mon, 07 Mar 2022 02:23:18 +0000 en hourly 1 https://wordpress.org/?v=6.8.1 https://albebaubles.com/wp-content/uploads/2019/10/cropped-247306-3-32x32.png Swift – AlbeBaubles https://albebaubles.com 32 32 Too easy https://albebaubles.com/swift/too-easy/ https://albebaubles.com/swift/too-easy/#respond Sat, 19 Feb 2022 04:10:07 +0000 https://albebaubles.com/?p=554 A great example of how simple it is to construct a user interface in swiftUI

UntitledImage UntitledImage

]]>
https://albebaubles.com/swift/too-easy/feed/ 0
Extending UIColor https://albebaubles.com/swift/extending-uicolor/ https://albebaubles.com/swift/extending-uicolor/#respond Thu, 10 Feb 2022 01:13:04 +0000 https://albebaubles.com/?p=497 I use this so often I’ve added it to my global utilities class.  Seriously considering taking all my extensions open source – since I use in my utilities class at all clients.

extension UIColor {
    public func uiImage(_ size: CGSize = CGSize(width: 0.1, height: 0.1)) -> UIImage {
        UIGraphicsImageRenderer(size: size).image { rendererContext in
            self.setFill()
            rendererContext.fill(CGRect(origin: .zero, size: size))
        }
    }

	 /// creates a cgImage from this color
	 /// - Parameter size: (CGSize) the size of the image
	 /// - Returns: cgImage
  public func cgImage(_ size: CGSize = CGSize(width: 0.1, height: 0.1)) -> CGImage {
        self.uiImage(size).cgImage!
    }

	 /// creates a square Swift Image with this color as background
	 /// - Parameters:
	 ///   - size: size of the image to be created
	 ///   - label: text to dispaly within the image
	 /// - Returns: cgImage
    public func swiftImage(_ size: CGSize = CGSize(width: 0.1, height: 0.1),
                           _ label: String = String.empty) -> Image {
        Image(self.cgImage(size), scale: CGFloat(2), label: Text(verbatim: label))
    }


	 /// creates a Swift Color from this UIColor
	 /// - Returns: Swift Color
  public func swiftColor() -> Color {
	 Color(self)
  }
}

 

]]>
https://albebaubles.com/swift/extending-uicolor/feed/ 0
Ad block – AlbeBlocksAnnoyances https://albebaubles.com/swift/ad-block-albeblocksannoyances/ https://albebaubles.com/swift/ad-block-albeblocksannoyances/#respond Sun, 12 Jan 2020 16:56:02 +0000 http://albebaubles.com/?p=109 Continue reading Ad block – AlbeBlocksAnnoyances]]> [UPDATED TO SUPPORT iOS]

I quit using Facebook well over a year ago, yet anytime my browser takes me there it shows me logged in.  I DO connect to FB on my oculus – no choice.  I don’t know how, but it sure seems using the oculus somehow communicates with my Mac and logs me into FB.

I took matters into my own hands, and wrote a quick Safari extension that blocks all things Facebook, as well as 3500 or more ad sites.

The app is open source and available at:

 

https://github.com/albebaubles/AlbeBlocksAnnoyances

 

 

NewImage

]]>
https://albebaubles.com/swift/ad-block-albeblocksannoyances/feed/ 0