dagronf / dsfstepperview Goto Github PK
View Code? Open in Web Editor NEWA custom stepper text field for macOS and iOS, supporting Swift, Objective-C, SwiftUI and Catalyst
License: MIT License
A custom stepper text field for macOS and iOS, supporting Swift, Objective-C, SwiftUI and Catalyst
License: MIT License
This is most likely an error from inexperience with mac on my part (I only got it 2 days ago), but after using the swift package manager to add this module as a dependency, I was unable to then import it as in ContentView.swift... Is "import DSFStepperView" the right way/name to import it? I've imported other dependencies without an issue, this is the only one so far which gives me the "No such module 'DSFStepperView'" error.
On the documentation I see this this text:
let format = NumberFormatter()
format.numberStyle = .decimal
// Always display a single digit fractional value.
format.allowsFloats = true
format.minimumFractionDigits = 1
format.maximumFractionDigits = 1
stepperView.numberFormatter = format
but have this error is try in my code
numberFormatter' is inaccessible due to 'internal' protection level
Thanks,
Hi,
I have add a simple function for check input on the NSTextField (macOS only)
Add this extension
extension String {
func isNumber() -> Bool {
return !self.isEmpty && self.rangeOfCharacter(from: CharacterSet.decimalDigits) != nil && self.rangeOfCharacter(from: CharacterSet.letters) == nil
}}
Add this code on the stepper view class
func
_evt(_ e:NSEvent) -> NSEvent?
{
if e.type == .keyDown
{
if let s = e.characters
{
if s.rangeOfCharacter(from: CharacterSet.alphanumerics) == nil
{
return e
}
if s.isNumber()
{
return e
}
return nil
}
}
return e
}
public func
use_filter()
{
NSEvent.addLocalMonitorForEvents(matching: [.keyDown], handler: _evt)
}
Call method use_filter()
mystepper1. use_filter()
Now you can hit only number in NSTextField (alphanumbers are correct check but if you hit "%" doesn't work!)
May be is utile for you in future version ?
Hi,
On example
when I click on "+" or "-" button, when I release the mouse bouton
the nsbutton disappears!!
When I added this to an existing project via SPM, I was unable to get it to build to run on a device, but it ran just fine in the simulator. I received this error:
No such file or directory: '/Users/andrewmagruder/Library/Developer/Xcode/DerivedData/Multi-Tool-eltmjcbmaxjdygagnsgbmawozdfs/Build/Products/Debug-iphoneos/PackageFrameworks/DSFStepperView-shared.framework/DSFStepperView-shared'
To correct this, I went Target->Frameworks, Libraries, and Embedded Content->DSFStepperView-shared->Filters->Unchecked "Allow on any platform" && "iOS".
This cleared my linker error and now the app builds/runs on device and in simulator.
Xxode: 15.2. iOS: 17.2. Device: iPhone 14 Pro Max.
Works great! Thank you! ๐
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.