Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Socket
Sign inDemoInstall

github.com/johnnycuongn/swipestrikethrough

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/johnnycuongn/swipestrikethrough


Version published
Created
Source

SwipeStrikeThrough

About

A simple framework with strikethrough applications:

  • Add strike through to your string,
  • StrikeThroughLabel helps swiping to strike easier

How To Use

Add strikethrough to a string

var myLabel = "aaaaaa"

// Add strikethrough
var strikedLabel = myLabel.strikeThrough(.add)

// Remove strikethrough from attributedString
var unStrikedLabel = strikedLabel?.string.strikeThrough(.remove)

Add a label that can swiped to strike by user

// In ViewController
@IBOutlet weak var myLabel: StrikeThroughLabel!

That's all you have to do, by replace UILabel with StrikethroughLabel

→ Now when you swipe, the strikethough will follow

Notice ⚠️

Multiple Gestures

If you applied to mutiple gesture, make sure to conform to UIGestureRecognizerDelegate, with below function:

override func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool {
        return true
    }

Make sure to refer to: https://developer.apple.com/documentation/uikit/touches_presses_and_gestures/coordinating_multiple_gesture_recognizers

Drawbacks

StrikeThroughLabel use only PanGestureRecognizer, with panning right enable but not left enable.

Solutions

You can add another Pan Gesture, or change directly into framework code

Inside function handlePan(gesture:) :

xTranslation > 0: User start swiping from left to right (This is already for swipe to strike through)

xTranslation < 0 : User start swiping from right to left (Not yet handle)

Installation

Download clone and embeded into your project:

  1. Download
  2. Drag .xcodeproj into your source
  3. Embed framework in General → Frameworks and Libraries

FAQs

Package last updated on 24 Nov 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc