SimpleMagnifyingView can be used as a magnifier as the one iOS providing 🔍. SwiftUI supported!

Overview

SimpleMagnifyingView

Banner

SimpleMagnifyingView is a SwiftUI view which can create a magnifier

中文说明

Demo Demo1

How it works

How It Works

Example

MagnifierView(isMagnifying: $isMagnifying, scale: .constant(1.8)) {
    Text("Hello world")
        .foregroundColor(.white)
        .frame(maxWidth: .infinity, maxHeight: .infinity)
        .background(.cyan)
}
.outlineColor(.white)
.closeButtonColor(.white)

To run the example project, clone the repo, and run pod install from the Example directory first.

Interfaces

Initialization

init(
    isMagnifying: Binding<Bool>,    // control the visibility
    scale: Binding<CGFloat> = .constant(2.0),
    glassShape: AnyShape = AnyShape(RoundedRectangle(cornerRadius: 12.0)),
    @ViewBuilder _ content: () -> Content
)

Methods for magnifying glass

// Config the size of the magnifying glass
func magnifyingGlassSize(_ size: CGSize)

// Config the shape of the magnifying glass
func magnifyingGlassShape(_ shape: AnyShape)

// Set the scale of the handle width
func handleWidthRatio(_ ratio: CGFloat)

// Set the height of the handle
func handleHeight(_ height: CGFloat)

// Set the outline color of the magnifying glass
func outlineColor(_ color: Color)

// Set the outline width of the magnifying glass
func outlineWidth(_ width: CGFloat)

// Enable or disable interactions in the magnifying glass
func enableHitInMagnifyingGlass(_ enabled: Bool)

Methods for mask

// Set the background color of the mask
func maskBackgroundColor(_ color: Color)

// Set the size of the close button
func closeButtonSize(_ size: CGSize)

// Set the foreground color of the close button
func closeButtonColor(_ color: Color)

// Enable or disable(or hide) close button
func enableCloseButton(_ enabled: Bool)

Execute Xcode's Product > Build Documentation and go to SimpleMagnifyingView's documentation for more details.

Requirements

Swift >= 5.0

Installation

SimpleMagnifyingView is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'SimpleMagnifyingView'

# Note that if cocoapods cannot find `SimpleMagnifyingView`, please try the command below
# pod `SimpleMagnifyingView`, :git => 'https://github.com/Tomortec/SimpleMagnifyingView.git'

Author

Tomortec, [email protected]

License

SimpleMagnifyingView is available under the MIT license. See the LICENSE file for more info.

You might also like...
Server Driven UI can enable faster iterations and allowing apps to instantly update on multiple platforms.

Pets App Server Driven UI can enable faster iterations and allowing apps to instantly update on multiple platforms Steps to run Pets-Web: Download or

Library that makes it easy to create multiple environments within a single app. You can switch environments without deleting the application.

AppContainer Library that makes it easy to create multiple environments within a single app. You can switch environments without deleting the applicat

What's New In SwiftUI for iOS 16 - Xcode 14 -  SwiftUI 4.0
What's New In SwiftUI for iOS 16 - Xcode 14 - SwiftUI 4.0

SwiftUI4 What's New In SwiftUI for iOS 16 - Xcode 14 - SwiftUI 4.0 (Work in progress....) Swift Charts Presentation Detents(Half Sheet & Small Sheets)

LinkedIn-Profile - UI of Android LinkedIn App Profile Page  in iOS SwiftUI
LinkedIn-Profile - UI of Android LinkedIn App Profile Page in iOS SwiftUI

LinkedIn-Profile UI of Android LinkedIn App Profile Page in iOS SwiftUI Sample I

A iOS SwiftUI framework for displaying data from an api inside a List.

FeedListKit FeedListKit is a high level framework for representing data from an Api inside a SwiftUi List. It automatically handles refreshing and loa

The most powerful Grid container missed in SwiftUI
The most powerful Grid container missed in SwiftUI

Grid Grid view inspired by CSS Grid and written with SwiftUI We are a development agency building phenomenal apps. Overview Grid is a powerful and eas

Flow layout / tag cloud / collection view in SwiftUI.
Flow layout / tag cloud / collection view in SwiftUI.

SwiftUIFlowLayout A Flow Layout is a container that orders its views sequentially, breaking into a new "line" according to the available width of the

NStack is a SwiftUI view that allows you to hoist navigation state into a Coordinator

An NStack allows you to manage SwiftUI navigation state with a single stack property. This makes it easy to hoist that state into a high-level view, such as a coordinator. The coordinator pattern allows you to write isolated views that have zero knowledge of their context within the navigation flow of an app.

Half modal view for SwiftUI
Half modal view for SwiftUI

ResizableSheet ResizableSheeet is a half modal view library for SwiftUI. You can easily implement a half modal view. Target Swift5.5 iOS14+ Installati

Owner
Tomortec
An innovation team whose members include @LMLAZ @TomortecAlbert
Tomortec
MisterFusion is Swift DSL for AutoLayout. It is the extremely clear, but concise syntax, in addition, can be used in both Swift and Objective-C. Support Safe Area and Size Class.

MisterFusion MisterFusion makes more easier to use AutoLayout in Swift & Objective-C code. Features Simple And Concise Syntax Use in Swift and Objecti

Taiki Suzuki 316 Nov 17, 2022
Horizontal and Vertical collection view for infinite scrolling that was designed to be used in SwiftUI

InfiniteScroller Example struct ContentView: View { @State var selected: Int = 1 var body: some View { InfiniteScroller(direction: .ve

Serhii Reznichenko 5 Apr 17, 2022
Auto Layout (and manual layout) in one line.

Auto Layout (and manual layout) in one line. Quick Look view.bb.centerX().below(view2).size(100) It’s equivalent to iOS 9 API: view.centerXAnchor.cons

Javier Zhang 74 Oct 19, 2022
This "Calculator" application is a simple one screen design of calculator screen i have made this single screen design application just to practice AutoLayout concepts.

Calculator Layout This "Calculator" application is a simple one screen design of calculator screen i have made this single screen design application j

Chetan Parate 1 Oct 29, 2021
FreeOTP is a two-factor authentication application for systems utilizing one-time password protocols

FreeOTP FreeOTP is a two-factor authentication application for systems utilizing one-time password protocols. Tokens can be added easily by scanning a

FreeOTP 551 Dec 28, 2022
A tiny category on UIView that allows you to set one property: "parallaxIntensity" to achieve a parallax effect with UIMotionEffect

NGAParallaxMotion A tiny category on UIView that allows you to set one property: parallaxIntensity to achieve a parallax effect with UIMotionEffect. S

Michael Bishop 650 Sep 26, 2022
A set of libraries used for parsing representations of Swift Packages similar to how SwiftPM itself works

A set of libraries used for parsing representations of Swift Packages similar to how SwiftPM itself works, but also supporting Xcode specific features (such as Swift Playground Apps).

Liam Nichols 0 Jan 8, 2022
Powerful autolayout framework, that can manage UIView(NSView), CALayer and not rendered views. Not Apple Autolayout wrapper. Provides placeholders. Linux support.

CGLayout Powerful autolayout framework, that can manage UIView(NSView), CALayer and not rendered views. Has cross-hierarchy coordinate space. Implemen

Koryttsev Denis 45 Jun 28, 2022
📱AutoLayout can be set differently for each device

DeviceLayout DeviceLayout is a Swift framework that lets you set Auto Layout constraints's differently for each device Using only IBInspector of Xcode

Cruz 171 Oct 11, 2022
Reusable GridView with excellent performance and customization that can be time table, spreadsheet, paging and more.

GridView GridView can tile the view while reusing it. It has an API like UIKit that works fast. Even when device rotates it smoothly relayout. Appetiz

Kyohei Ito 830 Dec 23, 2022