Giter Club home page Giter Club logo

luminous's Introduction

Luminous

Luminous

Example

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

Requirements

  • iOS 12+
  • Swift 5

Installation

Luminous is available through Swift Package Manager and CocoaPods.

Swift Package Manager

Add https://github.com/andrealufino/Luminous as the URL of the library. Deviice will also be imported.

CocoaPods

To install it, simply add the following line to your Podfile:

pod "Luminous"

Then use import Luminous wherever you want to use the library.

Dependencies

Luminous has only 1 dependency : Deviice which is my other library useful to know on which device your app is running on, plus some nice information. This dependency is no more actually used since version 2.2.0, but it is still there when you add Luminous.

Version 2.2.0 - Breaking Change

In version 2.2.0 I updated the Luminous.Hardware.Device structure, removing the current var that was returning a Deviice object. Given that the Deviice library has been updated to version 2, I took the opportunity to make a change also here. So, Luminous still automatically download the Deviice library, but it is not using it in the framework. If you want to get the Deviice (or, better, the new Device) object, you have to do it importing Deviice and use everything from there.

Migration to version 2

In version 2, I've changed some things and added others. An important change has been made to the structure of the library, useful for who wants to contribute to the project and to who wants to fork it. I created a specific file (extension) for every substruct.

Changed

  • LMBatteryState has been renamed to BatteryState
  • LMSizeScale has been renamed to MeasureUnit
  • Luminous.Carrier.allowsVOIP has been renamed to isVoipAllowed
  • Luminous.Hardware.physicalMemory(withScale: _) now returns a Double and no more a Float
  • All the structs are now accessible using Luminous.<substruct> as I removed the System middleware struct since it became useless
  • NSLocale is no more used in the library. I switched to Locale
  • Disk substruct now has a new method to return the totalSpace, freeSpace and usedSpace that takes a MeasureUnit parameter as input. The old vars that returned String and percentage have been deprecated and will be removed in the next version

Added

  • Audio (thanks to GregOriol)
    • currentAudioOutputVolume
    • secondaryAudioShouldBeSilencedHint
  • SystemVersion (from version 2.1.0) : this has been added under the Hardware struct and represents the system version

What is Luminous?

Luminous is the son of ALSystemUtilities library which is no longer maintained (it still is my best library on github). I got ideas from that one and I wrote everything from scratch in Swift adding some new feature and designing it in a different way thanks to the differences between Objective-C and Swift.

Luminous is a big library that I like to consider an "Helper Library". It provides a lot of information about the system and has some features that can speed up significantly the development process.

It is composed by 3 parts : - system information (Luminous.System.<substruct>) - utils (some handy method like the email check) - custom app configuration

Luminous is no more composed by 3 parts as I think that a library has to serve one and one only purpose. I removed the Utils and AppConfiguration structs. I'm sorry for any kind of inconvenience this could cause to everyone is using it, but I think that it's the right choice.

System information

Here I provide tons of information about the system and you can access them using the notation Luminous.<substruct>.

There are 11 different substructs here from which you can get information :

  • Network
    • isConnectedViaWiFi
    • isConnectedViaCellular
    • SSID (deprecated on iOS 13)
  • Locale
    • currentLanguage
    • currentTimeZone
    • currentTimeZoneName
    • currentCountry
    • currentCurrency
    • currentCurrencySymbol
    • usesMetricSystem
    • decimalSeparator
  • Carrier
    • name
    • ISOCountryCode
    • mobileCountryCode
    • networkCountryCode (deprecated, use mobileNetworkCode instead)
    • mobileNetworkCode
    • allowsVOIP
  • Hardware
    • SystemVersion struct
    • processorsNumber
    • activeProcessorsNumber
    • physicalMemory
    • systemName
    • systemVersion (this is a SystemVersion struct from version 2.1.0, no more a String)
    • bootTime
    • isLowPowerModeEnabled
    • Screen
      • brightness
      • isScreenMirrored
      • nativeBounds
      • nativeScale
      • bounds
      • scale
      • snapshotOfCurrentView
    • Device
      • current (returns a Deviice object)
      • identifierForVendor
      • orientation
    • Accessory
      • count
      • connectedAccessoriesNames
      • connectedAccessories
    • Sensors
      • isAccelerometerAvailable
      • isGyroAvailable
      • isMagnetometerAvailable
      • isDeviceMotionAvailable
  • Audio
    • currentAudioOutputVolume
    • secondaryAudioShouldBeSilencedHint
  • Disk
    • totalSpace
    • freeSpace
    • usedSpace
    • totalSpaceInBytes
    • freeSpaceInBytes
    • usedSpaceInBytes
    • freeSpaceInPercentage
    • usedSpaceInPercentage
  • Battery
    • level
    • state
  • Application
    • version
    • build
    • completeAppVersion
    • clipboardString

Why Luminous?

I'm sure you're asking yourself "Why this library is called Luminous?". Well, stop think about it. The reason is simple : I like the word "Luminous", it gives me a unique feeling of something that is bright and awesome! So, I chose to call this lib in that way! But you can think that "Luminous is because this library will light up your way of development speeding up it and giving you more time for yourself", this is more philosophical.

Help

Any suggestion would be really appreciated. The library is designed using structs and static functions, but I'm still not sure of this choice. I'm struggling if the best is to use static functions or static vars, so this is the first point you can help me with.

Author

Andrea Mario Lufino.

License

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

luminous's People

Contributors

andrealufino avatar gregoriol avatar xc0der 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

luminous's Issues

replace functions with vars

There are many functions without arguments.

It would be nice if parenthesis can be omitted.

Instead of invoking isConnectedViaWiFi(), then invoke isConnectedViaWiFi

Obj-c Compatibility

I realize that everything built in this library is a public struct, which means it isn't accessible via obj-c... any chance you can make an obj-c compatible version?

Would be FIRE

Thanks.

macOS Support

This is a really awesome project!!
Would love to see a macOS support!!

Wrong function called

Hi,

In the file Luminous.swift, var usedSpace:

/// The used disk space in string format (megabytes)
public static var usedSpace: String {
    return ByteCountFormatter.string(fromByteCount: freeSpaceInBytes, countStyle: ByteCountFormatter.CountStyle.binary)
}

freeSpaceInBytes are called, instead of usedSpaceInBytes

Problems with SystemVersion

Hi @andrealufino,

I have 2 issues with the SystemVersion struct:
1/ it seems that major, minor and path values are currently all set to the "first" component

            major = Int(components.first!)!
            minor = Int(components.first!)!
            patch = Int(components.first!)!

which doesn't seem correct?

2/ there doesn't seem to be any way to retrieve any of the values, either major/minor/patch or the full string value as everything is private, which makes it mostly useless?

pod install issue

[!] Unable to find a specification for Luminous

Here is the podfile

platform :ios, '10.0'
use_frameworks!

target 'my_tutorial' do
pod 'Luminous'
end

Use Release Notes

Can we create detailed releases notes for future releases, please?

It will be better for the community to follow evolutions ;)

Thanks!

Manual Installation

CocoaPods and Carthage are awesome tools and make our life really easier, but there are some devs who still don't know how to use them.

It would be cool to add the Manual installation guide in your README.md. You can take a look at my iOS Readme Template to see how you can do it.

No more CNCopyCurrentNetworkInfo access

iOS 13 breaking change on SSID network

Apple does not grant access to CNCopyCurrentNetworkInfo API anymore, as communicated by Apple on August 7th, 2019 :

As we announced at WWDC19, we're making changes to further protect user privacy and prevent unauthorized location tracking. Starting with iOS 13, the CNCopyCurrentNetworkInfo API will no longer return valid Wi-Fi SSID and BSSID information.

Instead, the information returned by default will be: 



  • SSID: “Wi-Fi” or “WLAN” (“WLAN" will be returned for the China SKU)
  • BSSID: "00:00:00:00:00:00" 

If your app is using this API, we encourage you to adopt alternative approaches that don’t require Wi-Fi or network information.

Valid SSID and BSSID information from CNCopyCurrentNetworkInfo will still be provided to VPN apps, apps that have used NEHotspotConfiguration to configure the current Wi-Fi network, and apps that have obtained permission to access user location through Location Services. 

Test your app on the latest iOS 13 beta to make sure it works properly.

If your app requires valid Wi-Fi SSID and BSSID information to function, you can do the following:
• For accessory setup apps, use the NEHotSpotConfiguration API, which now has the option to pass a prefix of the SSID hotspot your app expects to connect to.
• For other types of apps, use the CoreLocation API to request the user’s consent to access location information.

Solution

  • Use alternative API to get SSID information

NEW MODELS

Hi,
Thanks for this really useful tool.
Will you update it for new iPhone
& iPad models for example 11, 12 etc.

Thanks again.
George

Add audio output volume information

It could be possible to add current audio output volume information this way:

try? AVAudioSession.sharedInstance().setActive(true)
volume = AVAudioSession.sharedInstance().outputVolume
try? AVAudioSession.sharedInstance().setActive(false)

What do you think?

Is Deviice actually used in Luminous?

From a quick search in the code, I don't seem to find any reference to Deviice/Device in the current Luminous code; is the dependency actually used? or planned to be used? or could it be removed?

Deviice update

Hi,

You have updated Deviice here, but not the dependency linked with the Luminous pod.

Possible to have an update of Deviice ?

Thanks

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.