Code Monkey home page Code Monkey logo

gsmessages's Introduction

Hi there 👋

  • 🇨🇳 I’m an iOS developer in Beijing
  • 💻 Focusing on Swift & iOS
  • 🌟 Github is amazing, I hope to create more useful things here

My SwiftUI Frameworks:

  • SwiftUI-WeChat: 🇨🇳 Learn how to make WeChat with SwiftUI. 微信 7.0 🟢
  • VideoPlayer: 📽 A video player for SwiftUI, support for caching, preload and custom control view.
  • Refresh: 🎈 Great SwiftUI drop-down refresh and scroll up to load more. 下拉刷新、上拉加载
  • TabBar: 🚥 TabBar for SwiftUI - Make custom TabView possible.

My UIKit Frameworks:

  • SwiftTheme: 🎨 Powerful theme/skin manager for iOS 9+ 主题/换肤, 暗色模式
  • GSMessages: A simple style messages/notifications, in Swift.
  • GSImageViewerController: An image viewer controller with zoom transition, in Swift.
  • GSPlayer: ⏯ Video player, support for caching, preload, fullscreen transition and custom control view.
  • GSRefresh: Fully customizable drop-down refresh and load more. 下拉刷新、上拉加载
  • GSCaptchaButton: 为普通按钮增加验证码倒计时功能,不影响按钮样式
  • GSChange: Automatically synchronize changes, such as likes, follow, etc.
  • GSVerificationCode: 验证码控件,支持设置输入长度、自定义外观等
  • GSAlert: [deprecated] UIAlertController support iOS 7+ and written in swift.
  • GSPhotos: [deprecated] PhotosKit+ALAssetsLibrary, support iOS 7+ and written in swift.
  • POP-SnapKit: [deprecated] Use SnapKit with the Facebook Pop animation framework.

gsmessages's People

Contributors

cruisediary avatar eugenejeonme avatar gettoset avatar jaroslavas avatar kingcq avatar lixiang1994 avatar mibahl avatar tamanyan avatar terryworona avatar vmouta avatar wxxsw 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

gsmessages's Issues

About orientation

I've noticed something I wouldn't call a issue, but a possible improvement:

After a message is displayed, if the user changes his iPhone orientation the displayed message is not being "resized and replaced" to fit to device's new orientation. Do you think it's something you'll be working on in the future? Maybe, if you won't, I could study your code and try to create this improvement, after I finish my current project (which's deadline is very soon)

UITableViewController

Hi.

I am using GSMessages in a lot of my projects and I really appriciate your work.

In one of my projects I noticed that if I create a GSMessage in a table view (after some debugging) the height variable is 20px more if I use it in a UITableView compared by another view.
If I choose to use the position .Bottom it actually shows the message out of sight.

Is it possible to fix that?

Regards
Eirik

Not working correctly when using on presentingViewController

Hi there!

I'm having an issue when I'm trying to display a message on the presentingViewController, the issue is that the height of the alert is the size of the navigation bar instead of the navigation bar height + additional height.

Do you know how to solve this?

Position margin

Thanks for this awesome tool!
Now, more than an issue, this would be kind of a suggestion.

It would be great if we could specify a top, right, left and/or bottom margin to the message view, because in my case, I have a view on the top of the screen.
I have also a view on background so I could use the view.showMessage(...) method, but the problem is that this view lays behind the top view, not below, so the message would appear on the absolute top of screen, not below the top view.

Thanks!

Crash when viewController dismissed

I found crash when pop ViewController from NavigationController while show GSMessage

becuase GSMessage has weak type View or ViewController

when ViewController dismissed variable inView should be nil

in screenShot
screen shot 2016-11-26 at 10 17 43 pm

messageView.frame = CGRect(x: 0, y: y, width: inView.bounds.size.width, height: messageHeight)

I think above code y = inView.bounds.size.height - height in function updateFrames()
can make crash too

Type 'String' has no member 'font'

I got error in this part
I'm using Xcode 9 with swift 4

let attributedText = NSAttributedString(
            string: text,
            attributes: [
                .font: GSMessage.font,
                .foregroundColor: UIColor.white,
                .paragraphStyle: NSParagraphStyle()
            ]
        )

Under the Navigation Bar

Hello there,

How is it possible to show up under the navigation bar and hold on even if users do scrolling?

AutoHide(false) : doesn't work

override func viewDidLoad() {
  super.viewDidLoad()

  GSMessage.warningBackgroundColor = UIColor(hue:0.72, saturation:0.16, brightness:0.37, alpha:1)
  GSMessageOption.AutoHide(false)

  NSNotificationCenter.defaultCenter().addObserver(self, selector: "showInternetConnectionError", name:UnrealityNoInternetConnection, object: nil)
}

func showInternetConnectionError(){
self.showMessage("The Internet connection appears to be offline.", type: .Warning, options: nil)
}

.AutoHide(false) doesn't work for me. What did I miss?
Thanks.

view height calculation when textNumberOfLines == 0

when I set textNumberOfLines == 0 the height is always wrong。
so I check the code as

@objc fileprivate func updateFrames() {
        guard inView != nil else { return }
        y       = 0
        offsetY = 0
        
        
        var textSize: CGSize = .zero
        
        if let attrText = messageText.attributedText {
            let size = CGSize(width: textWidth , height: 999)
            let framesetter = CTFramesetterCreateWithAttributedString(attrText)
            textSize = CTFramesetterSuggestFrameSizeWithConstraints(framesetter, CFRange(), nil, size, nil)
        }
        
        if textNumberOfLines == 0 {
            height = max(ceil(textSize.height / 2) + padding.vertical, height)
        }
        
        calculatePosition()
        
        updateMessageFrame()
        updateCornerRadius()
        updateMessageTextSize(textSize: textSize)
    } 

In this line

   if textNumberOfLines == 0 {
            height = max(ceil(textSize.height / 2) + padding.vertical, height)
        }

I do not think you need to divide by two,as I modified to

   if textNumberOfLines == 0 {
            height = max(ceil(textSize.height ) + padding.vertical, height)
        }

It's ok
Will have other problems?

Click handlers

Hello,

Can you put on the right side a 2 buttons? So that we have a message with actions - "Tap to see", "YES" OR "NO"

Problem with updating GSMessages with Carthage under Xcode 8

Hello,
when I try to update my project with using Carthage for Swift 3 (under Xcode 8) I always get following error:

`*** Building scheme "Alamofire iOS" in Alamofire.xcworkspace
2016-09-20 11:19:24.122 xcodebuild[20966:120977] [MT] PluginLoading: Required plug-in compatibility UUID 8A66E736-A720-4B3C-92F1-33D9962C69DF for plug-in at path '/Library/Application Support/Developer/Shared/Xcode/Plug-ins/VVDocumenter-Xcode.xcplugin' not present in DVTPlugInCompatibilityUUIDs
2016-09-20 11:19:24.124 xcodebuild[20966:120977] [MT] PluginLoading: Required plug-in compatibility UUID 8A66E736-A720-4B3C-92F1-33D9962C69DF for plug-in at path '
/Library/Application Support/Developer/Shared/Xcode/Plug-ins/UncrustifyPlugin.xcplugin' not present in DVTPlugInCompatibilityUUIDs
2016-09-20 11:19:24.124 xcodebuild[20966:120977] [MT] PluginLoading: Required plug-in compatibility UUID 8A66E736-A720-4B3C-92F1-33D9962C69DF for plug-in at path '/Library/Application Support/Developer/Shared/Xcode/Plug-ins/Alcatraz.xcplugin' not present in DVTPlugInCompatibilityUUIDs
2016-09-20 11:20:19.886 xcodebuild[21362:122725] [MT] PluginLoading: Required plug-in compatibility UUID 8A66E736-A720-4B3C-92F1-33D9962C69DF for plug-in at path '
/Library/Application Support/Developer/Shared/Xcode/Plug-ins/VVDocumenter-Xcode.xcplugin' not present in DVTPlugInCompatibilityUUIDs
2016-09-20 11:20:19.887 xcodebuild[21362:122725] [MT] PluginLoading: Required plug-in compatibility UUID 8A66E736-A720-4B3C-92F1-33D9962C69DF for plug-in at path '/Library/Application Support/Developer/Shared/Xcode/Plug-ins/UncrustifyPlugin.xcplugin' not present in DVTPlugInCompatibilityUUIDs
2016-09-20 11:20:19.888 xcodebuild[21362:122725] [MT] PluginLoading: Required plug-in compatibility UUID 8A66E736-A720-4B3C-92F1-33D9962C69DF for plug-in at path '
/Library/Application Support/Developer/Shared/Xcode/Plug-ins/Alcatraz.xcplugin' not present in DVTPlugInCompatibilityUUIDs
*** Building scheme "GSMessages" in GSMessages.xcodeproj
2016-09-20 11:20:51.261 xcodebuild[21431:123291] [MT] PluginLoading: Required plug-in compatibility UUID 8A66E736-A720-4B3C-92F1-33D9962C69DF for plug-in at path '/Library/Application Support/Developer/Shared/Xcode/Plug-ins/VVDocumenter-Xcode.xcplugin' not present in DVTPlugInCompatibilityUUIDs
2016-09-20 11:20:51.262 xcodebuild[21431:123291] [MT] PluginLoading: Required plug-in compatibility UUID 8A66E736-A720-4B3C-92F1-33D9962C69DF for plug-in at path '
/Library/Application Support/Developer/Shared/Xcode/Plug-ins/UncrustifyPlugin.xcplugin' not present in DVTPlugInCompatibilityUUIDs
2016-09-20 11:20:51.263 xcodebuild[21431:123291] [MT] PluginLoading: Required plug-in compatibility UUID 8A66E736-A720-4B3C-92F1-33D9962C69DF for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/Alcatraz.xcplugin' not present in DVTPlugInCompatibilityUUIDs
** CLEAN FAILED **

The following build commands failed:
Check dependencies
(1 failure)
** BUILD FAILED **

The following build commands failed:
Check dependencies
(1 failure)
A shell task (/usr/bin/xcrun xcodebuild -project /Users/admin/Documents/Projects/Volvo/DealerLocatoriOSGit/Network/Carthage/Checkouts/GSMessages/GSMessages.xcodeproj -scheme GSMessages -configuration Release -sdk iphoneos ONLY_ACTIVE_ARCH=NO BITCODE_GENERATION_MODE=bitcode CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES clean build) failed with exit code 65:
2016-09-20 11:20:51.261 xcodebuild[21431:123291] [MT] PluginLoading: Required plug-in compatibility UUID 8A66E736-A720-4B3C-92F1-33D9962C69DF for plug-in at path '/Library/Application Support/Developer/Shared/Xcode/Plug-ins/VVDocumenter-Xcode.xcplugin' not present in DVTPlugInCompatibilityUUIDs
2016-09-20 11:20:51.262 xcodebuild[21431:123291] [MT] PluginLoading: Required plug-in compatibility UUID 8A66E736-A720-4B3C-92F1-33D9962C69DF for plug-in at path '
/Library/Application Support/Developer/Shared/Xcode/Plug-ins/UncrustifyPlugin.xcplugin' not present in DVTPlugInCompatibilityUUIDs
2016-09-20 11:20:51.263 xcodebuild[21431:123291] [MT] PluginLoading: Required plug-in compatibility UUID 8A66E736-A720-4B3C-92F1-33D9962C69DF for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/Alcatraz.xcplugin' not present in DVTPlugInCompatibilityUUIDs
** CLEAN FAILED **

The following build commands failed:
Check dependencies
(1 failure)
** BUILD FAILED **

The following build commands failed:
Check dependencies
(1 failure)`

Do you know what can cause the issue? I believe that this message

GSMessages -configuration Release -sdk iphoneos ONLY_ACTIVE_ARCH=NO BITCODE_GENERATION_MODE=bitcode CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES clean build) failed with exit code 65:

somehow indicates the issue, but it tells nothing specific. Do you know if GSMessage can cause the issue?

message view is too high if view controller has no edgesForExtendedLayout

Within updateFrame() function the offsetY param is correctly updated to adapt to the status bar and navigation bar height. However, in case the viewController has no edgesForExtendedLayout this check should be avoided

switch position {
        case .top:
            if let viewController = inViewController {
                let navigation = viewController.navigationController ?? (viewController as? UINavigationController)
                let navigationBarHidden = (navigation?.isNavigationBarHidden ?? true)
                let navigationBarTranslucent = (navigation?.navigationBar.isTranslucent ?? false)
                let navigationBarHeight = (navigation?.navigationBar.frame.size.height ?? 44)
                let statusBarHidden = UIApplication.shared.isStatusBarHidden
                if !navigationBarHidden && navigationBarTranslucent && !statusBarHidden { offsetY+=20 }
                if !navigationBarHidden && navigationBarTranslucent { offsetY+=navigationBarHeight }
                if (navigationBarHidden && !statusBarHidden) { offsetY+=20 }
            }
            y = max(0 - inView.frame.origin.y, 0)
[...]
}

Type 'NSAttributedStringKey' (aka 'NSString') has no member 'font'

Been getting this error since installing the pod.

Type 'NSAttributedStringKey' (aka 'NSString') has no member 'font' 

I'm using the latest xcode 9.2 beta and the latest swift 4.0.3
I checked build settings and my target is using swift 4.

From my research, NSAttributedStringKey just got a member "font" in swift 4.

What else may be going on?

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.