Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
EyreFree committed Aug 15, 2019
0 parents commit d8bc14a
Show file tree
Hide file tree
Showing 95 changed files with 6,499 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# OS X
.DS_Store

# Xcode
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata/
*.xccheckout
profile
*.moved-aside
DerivedData
*.hmap
*.ipa

# Bundler
.bundle

# Add this line if you want to avoid checking in source code from Carthage dependencies.
# Carthage/Checkouts

Carthage/Build

# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control
#
# Note: if you ignore the Pods directory, make sure to uncomment
# `pod install` in .travis.yml
#
# Pods/
1 change: 1 addition & 0 deletions .swift-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
5.0
30 changes: 30 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
language: objective-c
osx_image: xcode10.2
env: SWIFT_SNAPSHOT=5.0

cache: cocoapods
podfile: Example/Podfile

env:
global:
- LANG=en_US.UTF-8
- LC_ALL=en_US.UTF-8
- XCODE_WORKSPACE=Example/EFFoundation.xcworkspace
- DESTINATION="OS=12.0,name=iPhone XS"
matrix:
- SCHEME="EFFoundation-Example"

before_install:
- gem install xcpretty --no-document --quiet
- gem install cocoapods --pre --no-document --quiet
- pod install --project-directory=Example

script:
- set -o pipefail
- pod repo update
- xcodebuild -workspace "$XCODE_WORKSPACE" -scheme "$SCHEME" -destination "$DESTINATION" -configuration Debug ONLY_ACTIVE_ARCH=NO build | xcpretty -c;
- xcodebuild -workspace "$XCODE_WORKSPACE" -scheme "$SCHEME" -destination "$DESTINATION" -configuration Release ONLY_ACTIVE_ARCH=NO build | xcpretty -c;
- pod lib lint --allow-warnings

after_success:
- sleep 3
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Change Log

-----

## [0.1.0](https://github.com/EFPrefix/EFFoundation/releases/tag/0.1.0) (2019-08-15)

- First public release.
46 changes: 46 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at eyrefree@eyrefree.org. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [https://www.contributor-covenant.org/version/1/4][version]

[homepage]: https://www.contributor-covenant.org
[version]: https://www.contributor-covenant.org/version/1/4/
70 changes: 70 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Contributing Guidelines

This document contains information and guidelines about contributing to this project.
Please read it before you start participating.

**Topics**

* [Asking Questions](#asking-questions)
* [Reporting Issues](#reporting-issues)
* [Developers Certificate of Origin](#developers-certificate-of-origin)

## Asking Questions

We don't use GitHub as a support forum.
For any usage questions that are not specific to the project itself,
please ask on [Stack Overflow](https://stackoverflow.com) instead.
By doing so, you'll be more likely to quickly solve your problem,
and you'll allow anyone else with the same question to find the answer.
This also allows maintainers to focus on improving the project for others.

## Reporting Issues

A great way to contribute to the project
is to send a detailed issue when you encounter an problem.
We always appreciate a well-written, thorough bug report.

Check that the project issues database
doesn't already include that problem or suggestion before submitting an issue.
If you find a match, add a quick "+1" or "I have this problem too."
Doing this helps prioritize the most common problems and requests.

When reporting issues, please include the following:

* The version of Xcode you're using
* The version of iOS or macOS you're targeting
* The full output of any stack trace or compiler error
* A code snippet that reproduces the described behavior, if applicable
* Any other details that would be useful in understanding the problem

This information will help us review and fix your issue faster.

## Developer's Certificate of Origin

By making a contribution to this project, I certify that:

- (a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or

- (b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or

- (c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.

- (d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.

---

*Some of the ideas and wording for the statements above were based on work by the [Alamofire](https://github.com/Alamofire/Alamofire/blob/master/CONTRIBUTING.md) communities. We commend them for their efforts to facilitate collaboration in their projects.*
29 changes: 29 additions & 0 deletions EFFoundation.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Pod::Spec.new do |s|
s.name = 'EFFoundation'
s.version = '0.1.0'
s.summary = 'EFFoundation.'

s.description = <<-DESC
EFFoundation.
DESC

s.homepage = 'https://github.com/EFPrefix/EFFoundation'
# s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { 'EyreFree' => 'eyrefree@eyrefree.org' }
s.source = { :git => 'https://github.com/EFPrefix/EFFoundation.git', :tag => s.version.to_s }
s.social_media_url = 'https://twitter.com/EyreFree777'

s.ios.deployment_target = '8.0'

s.source_files = 'EFFoundation/Classes/**/*'

# s.resource_bundles = {
# 'EFFoundation' => ['EFFoundation/Assets/*.png']
# }

# s.public_header_files = 'Pod/Classes/**/*.h'
s.frameworks = 'UIKit', 'Foundation'
s.dependency 'DeviceKit', '>= 2.0.0'
s.dependency 'ReachabilitySwift', '>= 4.3.1'
end
Empty file added EFFoundation/Assets/.gitkeep
Empty file.
Empty file added EFFoundation/Classes/.gitkeep
Empty file.
23 changes: 23 additions & 0 deletions EFFoundation/Classes/Array+.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//
// Array+.swift
// EFFoundation
//
// Created by EyreFree on 2019/8/14.
//

import UIKit

public extension Array where Element: Equatable {

mutating func removeFirst(_ value: Element) {
if let index = firstIndex(of: value) {
remove(at: index)
}
}

mutating func removeAll(_ value: Element) {
removeAll { element -> Bool in
return value == element
}
}
}
72 changes: 72 additions & 0 deletions EFFoundation/Classes/CGFloat+.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
//
// CGFloat+.swift
// EFFoundation
//
// Created by EyreFree on 2019/8/14.
//

import UIKit

public extension CGFloat {

static let screenWidth: CGFloat = UIScreen.main.bounds.size.width
static let screenHeight: CGFloat = UIScreen.main.bounds.size.height
static let screenMinEdge: CGFloat = Swift.min(screenWidth, screenHeight)

static let statusBarHeight: CGFloat = UIDevice.isiPhoneXSeries ? 44 : 20
static let navigationBarHeight: CGFloat = 44
static let tabBarHeight: CGFloat = bottomSafeAreaHeight + 55
static let bottomSafeAreaHeight: CGFloat = UIDevice.isiPhoneXSeries ? 34 : 0

var bool: Bool {
return 0 != self
}

var double: Double {
return Double(self)
}

var float: Float {
return Float(self)
}

var int: Int {
return Int(self)
}

var int8: Int8 {
return Int8(self)
}

var int16: Int16 {
return Int16(self)
}

var int32: Int32 {
return Int32(self)
}

var int64: Int64 {
return Int64(self)
}

var uInt: UInt {
return UInt(self)
}

var uInt8: UInt8 {
return UInt8(self)
}

var uInt16: UInt16 {
return UInt16(self)
}

var uInt32: UInt32 {
return UInt32(self)
}

var uInt64: UInt64 {
return UInt64(self)
}
}
55 changes: 55 additions & 0 deletions EFFoundation/Classes/CGRect+.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
//
// CGRect+.swift
// EFFoundation
//
// Created by EyreFree on 2019/8/14.
//

import UIKit

public extension CGRect {

var x: CGFloat {
get {
return self.origin.x
}
set {
var r = self
r.origin.x = newValue
self = r
}
}

var y: CGFloat {
get {
return self.origin.y
}
set {
var r = self
r.origin.y = newValue
self = r
}
}

var width: CGFloat {
get {
return self.size.width
}
set {
var r = self
r.size.width = newValue
self = r
}
}

var height: CGFloat {
get {
return self.size.height
}
set {
var r = self
r.size.height = newValue
self = r
}
}
}
15 changes: 15 additions & 0 deletions EFFoundation/Classes/CGSize+.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// CGSize+.swift
// DeviceKit
//
// Created by EyreFree on 2019/8/14.
//

import UIKit

public extension CGSize {

static var screen: CGSize {
return UIScreen.main.bounds.size
}
}

0 comments on commit d8bc14a

Please sign in to comment.