Giter VIP home page Giter VIP logo

swifterswift's People

Contributors

0mars avatar asura19 avatar basememara avatar be-meyer avatar calebkleveter avatar chalkdust avatar dependabot[bot] avatar freak4pc avatar gurgeous avatar guykogus avatar jayxiang avatar kaphacius avatar leluckyvint avatar lucianopalmeida avatar luoxiu avatar marcocapano avatar maxhaertwig avatar mmdock avatar n0an avatar nathanbacon avatar omaralbeik avatar pawurb avatar pvtmert avatar ratulsharker avatar romanpodymov avatar sd10 avatar shivahuang avatar staffler-xyz avatar stavares843 avatar tapanprakasht avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

swifterswift's Issues

Swift PM support

Since Swift 3 introduce Package Manager, any plans to support?

open instead of public

error when using this lib with a custom uicontrol.
complaining about Overriding non-open var outside defining module.

About the "Coding Style"

As I know, In Objective-C, Extension functions often write with a fix prefix. like "sd_xxx". I think swift extension should be do it as the same to forbidden conflict to other's extension?

UISegmentedControlExtensions return array of optional values

public var segmentTitles: [String?]

public var segmentImages: [UIImage?]

The implementation currently returns an empty array in the case where no titles exist.
I think it would be better to either:

a) Return an optional Array
b) Return an Array of non-optional elements

This would also eliminate double optional values from using .first property on the array

let doubleOptional = UISegmentedControl().segmentTitles.first

I would also like to remove the use of the while loops from the implementation of these properties.

I think its "swiftier" to use a for in range loop
so we don't have to keep track of and increment our own index.

Currently with while loop

public var segmentTitles: [String?] {
		get {
			var titles: [String?] = []
			var i = 0
			while i < numberOfSegments {
				titles.append(titleForSegment(at: i))
				i += 1
			}
			return titles
		}
		set {
			removeAllSegments()
			for (index, title) in newValue.enumerated() {
				insertSegment(withTitle: title, at: index, animated: false)
			}
		}
	}

With for in range loop:

public var segmentTitles: [String?] {
		get {
			var titles: [String?] = []
			for i in 0..<numberOfSegments {
				titles.append(titleForSegment(at: i))
			}
			return titles
		}
		set {
			removeAllSegments()
			for (index, title) in newValue.enumerated() {
				insertSegment(withTitle: title, at: index, animated: false)
			}
		}
	}

If anyone has some thoughts on this let me know. I'd like to make any changes under the same commit for testing of this class.

MD file error

I found something wrong in the document.
NSAttributedString extensions link to nothing
UIAlertController extensions link to NSAttributedString extensions

Typo in Wiki

There's a typo on the UINavigationItem Extensions page. The word navigation in the description column is misspelled.

Unable to find SwifterSwift

pod search SwifterSwift
[!] Unable to find a pod with name, author, summary, or description matching SwifterSwift

Poll: Add ss prefix to all extensions

While adding the SS prefix to all extensions will make them less readable, it could bring more compatibility with 3rd party libraries

Example:

[1, 2, 3].ssRandomItem
// or
[1, 2, 3].ss.randomItem

instead of:

[1, 2, 3].randomItem

Array: item(at: ) error if index is same as items

[1, 2, 3, 4, 5].item(at: 2) -> 3
[1.2, 2.3, 4.5, 3.4, 4.5].item(at: 3) -> 3.4
["h", "e", "l", "l", "o"].item(at: 10) -> nil

//bug
["h"].item(at: 1) -> error, should be nil
["h", "e"].item(at: 2) -> error, should be nil

xcode: 8.3
swift: 3.1
swifterswift: 1.6.3

Swift 4 Support

Swift 4

Xcode 9 beta with Swift 4 was announced yesterday ๐ŸŽ‰, whats new
All Swift 4 work will be done in the swift-4 branch and will be released as soon as Swift 4 is available officially

Looking for new contributors!

Help Wanted

Hey, everyone! SwifterSwift is looking for new contributors!

You can contribute to the project in a variety of ways:

  • Improve documentation ๐Ÿ™
  • Add more extensions ๐Ÿ‘
  • Add missing unit tests ๐Ÿ˜…
  • Fixing or reporting bugs ๐Ÿ˜ฑ

If you're new to Open Source or Swift the SwifterSwift community is a great place to get involved.
No contribution is too small.

If you have any questions or need help getting started -- feel free to let me know!

Swift Source Compatibility

Hello @omaralbeik . I have been away for a while but could not find time for contributing recently. Just found out that Apple is including OS projects into its Swift source compatibility testing. Maybe you would be interested in joining it? Unfortunately in the nearest future I will not have time to look into it.

https://swift.org/source-compatibility/

Add Subspecs support

Use Cocoapods Subspecs to divide the project into smaller sub projects so users can install everything or only what they need.

Suggested Subspecs

  • SwifterSwift/Foundation
  • SwifterSwift/UIKit
  • SwifterSwift/Cocoa

UIView rotate(toAngle

This method will reset all other transformations applied to the view. UIView rotate(byAngle behaves differently

Inconsistent naming...

Given the code:

public var nearestHourQuarter: Date {

...
public var nearestHalfHour: Date {

Shouldn't the first function be named "nearestQuarterHour", to match nearestHalfHour? Truthfully, when I was reading the code, I thought the function was named incorrectly even before I got to the second function. It just seems like it would be better to be consistent.

Is codecov report correct?

I was looking into codecov report to check how well the code is tested. But I found some disparity between codecov report and Xcode coverage report. For example look at the case of UISliderExtensions.
This is the codecov report for UISliderExtension where completion handler is not covered by test.
image
But when I run the same test in Xcode it is giving the following result where test coverage is 100%
image

Did anybody know why this disparity happens? Is it a bug with Codecov? Is there anything to do with xcpretty in travis file? Because following link says broken codecov with xcpretty.
codecov/example-swift

// and many others!

instead of // and many others! i would like to see a full doc of all functions and extensions

and mandatory for new pull requests

tvOS support

It would be nice if you could update the podspec to allow usage of this in a tvOS project as well.

Thanks,

pieter

UIView fadeIn fadeOut

Seems like fadeIn is setting the alpha to 0 and fadeOut is setting the alpha to 1. Is that correct?

Help please

Then use - let someString = String(" 123 ").trimmed
have error - Value of type "String?" has no member 'trimmed'

Why?

Drop method is missing

The following method is missing:

drop(while condition: (Element) -> Bool)

Drop elements of Array while condition is true.

type: Mutating Method.
parameters:
condition: condition to evaluate each element against.
availability: iOS 8+ tvOS 9+ watchOS 3+ macOS 10.10+.

Please update, thank you.

Is this a mistake?

In DateExtensions, for property 'year', why is the 'second' parameter set to newValue ?
Is this a mistake?

 public var year: Int {
		get {
			return calendar.component(.year, from: self)
		}
		set {
			self = Date(calendar: calendar, timeZone: timeZone, era: era, year: newValue, month: month, day: day, hour: hour, minute: minute, second: newValue, nanosecond: nanosecond)
		}
	}

UIView isVisible

The property returns true is it's not visible. Is that intended?

Increase test coverage

Currently test coverage is quite low, with a bunch of extension files not being tested at all.
coverage

Though there is no way to display a fancy coverage status badge in the readme it would still be nice to increase it. I don't have time to look into it right now but I would leave issue hanging around for others to see.

If someone feels like earning some cheap OS karma and get started on collaborating here it would be the simplest way to do it.

Please Split the project.

I think the project should be split into independent projects: CocoaExtensions and DataStructure extension. So the last could be reusable everywhere and not just for iOS. It is different type of expertise to write UIKit extensions and Data Structure ones. It is difficult achieve excellence in both.

Naming of Dequeue Functions in `UITableView` and `UICollectionView`

I found the functions in UITableView and UICollectionView extensions for dequeue cell have the prefix deque like the following:

public func dequeReusableCell<T: UITableViewCell>(withClass name: T.Type, for indexPath: IndexPath) -> T

, not dequeue. Is this a typo or for some reason?

Int.randomBetween(min:max) is changed to Int.random(between:max)

In the latest version Xcode is complaining about Int not having a static function called randomBetween. After looking at the source code I found that it is changed from Int.randomBetween(min: 5, max: 25) to Int.random(between: 5, max: 25). This change is not yet documented in your documentation.

I would also like to suggest tweaking the syntax to the following for nicer readability:

public static func random(between min: Int, and max: Int) -> Int {
	return random(inRange: min...max)
}

This would result in usage as Int.random(between: 5, and: 25)

DateExtensions.swift:215:27: Type 'Locale!' has no member 'posix'

public var iso8601String: String {
		// https://github.com/justinmakaila/NSDate-ISO-8601/blob/master/NSDateISO8601.swift
		let dateFormatter = DateFormatter()
		dateFormatter.locale = .posix
		dateFormatter.timeZone = TimeZone(abbreviation: "GMT")
		dateFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSS"
		
		return dateFormatter.string(from: self).appending("Z")
}

DateExtensions.swift:215:27: Type 'Locale!' has no member 'posix'

macOS Support

@pawurb Could you please help adding the targets and the initial setup, then I can check all extensions compatibility with macOS.
Thank you in advance!

Problem with SPM

Hi, i can't install with SPM...

using .Package(url: "https://github.com/SwifterSwift/SwifterSwift.git", versions: Version(1,4,0)..<Version(2, .max, .max)) i got this error:

Cloning https://github.com/SwifterSwift/SwifterSwift.git
error: The dependency graph could not be satisfied. The package (https://github.com/SwifterSwift/SwifterS
wift.git) with version tag in range (1.4.0..<2.9223372036854775807.9223372036854775807) is not found. Fou
nd tags ([1.0.2])

and with .Package(url: "https://github.com/SwifterSwift/SwifterSwift.git", majorVersion: 1, minor: 6) i got something similar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.