Giter VIP home page Giter VIP logo

swiftmessages's People

Contributors

albertosamele avatar allaire avatar amagrude avatar bastilimbach avatar canhth avatar ceyhun avatar coeur avatar defagos avatar gali8 avatar gcharita avatar ianyh avatar jaylyerly avatar jdlehman avatar joshhrach avatar kenji21 avatar kizitonwose avatar knothed avatar knox avatar libern avatar mesopelagique avatar miserylee avatar mojtabahs avatar ninefifteen avatar ollitapa avatar philprime avatar raven avatar rockerhx avatar srstanic avatar tbaranes avatar wtmoose 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

swiftmessages's Issues

Status bar shown in view controllers with a hidden status bar

SwiftMessages.defaultConfig.preferredStatusBarStyle = .None
let message = MessageView.viewFromNib(layout: .CardView)
message.configureTheme(theme)
message.configureContent(title: title, body: body)
message.button?.hidden = true
SwiftMessages.show(view: message)

In the view controller (obviously):

override func prefersStatusBarHidden() -> Bool {
    return true
}

When the MessageView is displayed, the view controller shows its status bar up until the moment the MessageView hides automatically.

Crash on jailbroken iPod Touch 6G

Got the following crash:

iPod Touch 6G on 9.3.3

Crashed: com.apple.main-thread
EXC_BREAKPOINT 0x000000010170847c

Crashed: com.apple.main-thread
0  SwiftMessages                  0x10170847c IconStyle.image(theme : Theme) -> UIImage (Theme.swift:37)
1  ios                            0x1000fccdc static MessageManager.showInfo(String, body : String) -> () (MessageManager.swift:71)
2  UIKit                          0x18783d944 -[UIPresentationController transitionDidFinish:] + 1320
3  UIKit                          0x18796e418 -[_UICurrentContextPresentationController transitionDidFinish:] + 44
4  UIKit                          0x187840b3c __56-[UIPresentationController runTransitionForCurrentState]_block_invoke_2 + 188
5  UIKit                          0x187611114 -[_UIViewControllerTransitionContext completeTransition:] + 116
6  UIKit                          0x187610f00 -[UITransitionView notifyDidCompleteTransition:] + 252
7  UIKit                          0x1876109fc -[UITransitionView _didCompleteTransition:] + 1164
8  UIKit                          0x18761055c -[UITransitionView _transitionDidStop:finished:] + 124
9  UIKit                          0x18751bc28 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 312
10 UIKit                          0x18751bab0 -[UIViewAnimationState animationDidStop:finished:] + 108
11 QuartzCore                     0x184e75998 CA::Layer::run_animation_callbacks(void*) + 284
12 libdispatch.dylib              0x181dd547c _dispatch_client_callout + 16
13 libdispatch.dylib              0x181ddab84 _dispatch_main_queue_callback_4CF + 1844
14 CoreFoundation                 0x182340d50 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
15 CoreFoundation                 0x18233ebb8 __CFRunLoopRun + 1628
16 CoreFoundation                 0x182268c50 CFRunLoopRunSpecific + 384
17 GraphicsServices               0x183b50088 GSEventRunModal + 180
18 UIKit                          0x18754a088 UIApplicationMain + 204
19 ios                            0x1000ec280 main (AppDelegate.swift:24)
20 libdyld.dylib                  0x181e068b8 start + 4```

Unable to find spec for Cocoapods

Great work on the library!
Unfortunately, I'm unable to build the library using cocoapods.
pod "SwiftMessages" results in
Analyzing dependencies [!] Unable to find a specification for SwiftMessages

Any guidance on this?

wierd opengl warning

Thanks guys first of all. Anyone experienced something like this?

I experienced the same bug on Version 8.2 (8C38) on a Swift project, it makes the app crash on a real device but just warns on the simulator

ERROR /BuildRoot/Library/Caches/com.apple.xbs/Sources/VectorKit_Sim/VectorKit-1230.32.8.29.9/GeoGL/GeoGL/GLCoreContext.cpp 1764: WARNING: Output of vertex shader 'v_gradient' not read by fragment shader

Just on one scene using a map but the issue dissapeared when I stopped displaying an info message with https://github.com/SwiftKickMobile/SwiftMessages

Just saying it could be an interaction between the mapkit and a 3rd party library

Hope it helps

https://forums.developer.apple.com/message/204771#204771

Tap to hide on "StatusLine" layout

I wonder if there's an option to hide the view when shown in status bar using following configurations.

view = MessageView.viewFromNib(layout: .StatusLine)
config.presentationContext = .window(windowLevel: UIWindowLevelStatusBar)
config.duration = .forever
config.dimMode = .gray(interactive: false)

In above settings, tap button handler is not getting called. How can I hide the view in this case.
I can hide the view when config.dimMode = .gray(interactive: true), but it dims background view.

Any suggestion or solution are welcome.

App going to background while presenting a message leaves "current" set incorrectly

How it looks: an app using SwiftMessages gets sent to the background while a SwiftMessage (that will be auto-hidden) is actively being presented; when the app returns, no more SwiftMessages ever appear.

What's happening: while SwiftMessages has a "current" Presenter being shown (i.e. SwiftMessages.current != nil), there is an autoHide block queued. When the app is sent to the background, the autoHide block can fire after the app is inactive/going to background.

The final step in "hideCompleted" is the block that is called back from the UIView animation that hides the view. This block requires that the "completed" boolean (which comes from the UIView animation) must be true; if it is not, it returns early (due to the guard statement). Unfortunately, when the app is going inactive/background, the UIView animation will indeed return with completed = false. Thus, that guard statement prevents the "current" variable from being cleared to nil.

At this point, no more messages can be shown, because dequeueNext requires "current" to be nil, and there is no way to clear that "stuck" presenter.

My suggestions: (Note: I'm relatively new to SwiftMessages, so I could be wrong!) The simplest possibility is to remove the guard statement in "hideCompleted" that requires the "completed" boolean to be true. I don't know any other situation in which "completed" could return false where you wouldn't want to clear out the current presenter. An alternative (though more complicated) would be to provide a synchronous "cancel" method that can be run on demand when the app is going to the background, that would cancel the previously queued autoHide block.

Comment: I work around this (and you could say this is the required proper usage) by calling "hideAll" while going inactive, but I am not convinced this will guarantee that the UIView animation will complete with a "completed = true" result, so I believe it would still be safer to remove that guard statement.

Thank you for a great library, by the way!

Dismiss only if tap is outside view

test

How can I dismiss a message only when there's a tap outside of the view? (highlighted in red here)

config.dimMode = .gray(interactive: true) applies to the entire screen, in that, any tap (even if outside the dimmed area) causes the view to be dismissed.

Present Message View right above keyboard

Not sure if this is allowed at this point, but has anyone tried presenting MessageView right above the keyboard? Right now my MessageView overlaps with the keyboard.

Keyboard behavior on presenting view

Continuation of #36

When the message comes-in, the keyboard disappear and when message comes-out, the keyboard appear again.

Would be really nice if SwiftMessages handle this, and keep the keyboard open and functional. May limit the UIWindow size for message.

SM Not showing up after UIAlertController

I'm using al alert controller in my application along with SwiftMessages. SM is working fine, untill I've called an AlertController. Once the Alert Controller goes, then the SM is not showing up throughout the app. Guess the issue #30 still exists.

 var config = SwiftMessages.Config()
config.presentationContext = .Window(windowLevel: UIWindowLevelStatusBar)
let view = MessageView.viewFromNib(layout: .CardView)
view.configureTheme(.Warning)
view.configureDropShadow()
let iconText = ["๐Ÿค”", "๐Ÿ˜ณ", "๐Ÿ™„", "๐Ÿ˜ถ"].sm_random()!
view.configureContent(title: "Oops!", body: message, iconText: iconText)
view.button?.hidden = true
        
SwiftMessages.show(view: view)

is the code I use to show SM. I have tried using UIWindowLevelAlert and UIWindowLevelNormal.

Crash on jailbroken device loading image from nib

Could not load the "errorIcon" image referenced from a nib in the bundle with identifier "org.cocoapods.SwiftMessages"
fatal error: unexpectedly found nil while unwrapping an Optional value

also clean build .... not work

Resize MessageView iconImageView

How can I set the iconImageView size?

     `let view = MessageView.viewFromNib(layout: .CardView)
        view.configureTheme(backgroundColor: Colors.searchResultBGColor, foregroundColor: UIColor.black)
        view.configureContent(title: senderDisplay, body: body)
        view.titleLabel?.textColor = Colors.appGreen
        view.titleLabel?.numberOfLines = 1
        view.bodyLabel?.numberOfLines = 2
        view.iconImageView?.isHidden = false
        view.iconImageView?.frame = CGRect(x: 0, y: 0, width: 30, height: 30)
        view.iconImageView?.layer.cornerRadius = 15
        view.iconImageView?.contentMode = .scaleAspectFill
        view.iconImageView?.clipsToBounds = true
        view.iconImageView?.kf.setImage(with: url)
        
        view.configureDropShadow()
        view.button?.isHidden = true
        
        // Hide when message view tapped
        view.tapHandler = { _ in
            
            print("tapped the messsage view")
            SwiftMessages.hide()
        }
        var config = SwiftMessages.Config()
        
        config.presentationStyle = .top
        // Display in a window at the specified window level: UIWindowLevelStatusBar
        // displays over the status bar while UIWindowLevelNormal displays under.
        config.presentationContext = .window(windowLevel: UIWindowLevelNormal)
        config.interactiveHide = true
        SwiftMessages.show(config: config, view: view)`

adjusting the frame.size.height/width properties dont work either. The image just resizes in the stack view.

No Add EventListener Sample

Would be great if you could explain how to add EventListeners. Best practice to listen for onHide or didHide MessageView.

Message Top Padding

Is there anyway to push the message down from the top? I want the message to be be shown below my applications header.

Could not load the "errorIcon" image

Good day, everything had been working perfectly for a few weeks but after the recent Xcode update I keep getting the following error: Could not load the "errorIcon" image referenced from a nib in the bundle with identifier "org.cocoapods.SwiftMessages"
fatal error: unexpectedly found nil while unwrapping an Optional value

If I supplement the cancel image with another and make all the relevant changes, the error simply persists with the new image too.

Any recent issues you're aware of in this regard? This is not in production, simply run within the Simulator. Cheers

xcode 8: value of type 'T'? has no member 'first'

Hi,

I just upgraded xcode 7.3 to xcode 8.0. All sudden I am getting

value of type 'T'? has no member 'first' error in SwiftMessages.swift file (internalViewFromNib method).

Can you please help me to fix this issue.

thanks

Memory Leak

When initialing and showing multiple MessageView. Even all message views are dismissed, they are not released from the memory.

iOS version: 10.2
SwiftMessage version: 3.1.3 & 3.0.3
Xcode version: 8.2

screen shot 2017-01-20 at 13 27 56

Hide algorithm

SwiftMessages implements Identifiable like this:

open var id: String {
        return "MessageView:title=\(titleLabel?.text), body=\(bodyLabel?.text)"
    }

For my usage when user taps on refresh button and internet connection isn't present user needs to know if refresh succesful.
Refresh working very fast, and previous message haven't been removed yet from the queue.
When new message (the same, about internet connection) is generated it is deleted from queue because id property is generated from title and body.

The question is how to add two messages to queue with the same title and body?

My thought is maybe make id property settable?

Set Id

Is there a way to set an id for a message? If not, is this a feature that you anticipate implementing?

The use case that I am looking for is hiding a specific message. For example, if I create a message with a title of "Please enter a valid email address" and an empty body, the id is

"MessageView:title=Optional("Please enter a valid email address"), body=Optional("")".

In order to get the id so that I could hide the message, I had to print the id to the console so that I could then add it to the code to hide a message.

Thanks in advance.

Could not load NIB in bundle issue

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle </Users/iOS/Library/Developer/Xcode/DerivedData/marksix-ccpkaihhjxcprxalsglvfbucokfl/Build/Products/Debug-iphonesimulator/SwiftMessages.framework> (loaded)' with name 'CardView''
*** First throw call stack:
(
0 CoreFoundation 0x000000010b784d85 exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010b1badeb objc_exception_throw + 48
2 CoreFoundation 0x000000010b784cbd +[NSException raise:format:] + 205
3 UIKit 0x000000010788ec89 -[UINib instantiateWithOwner:options:] + 499
4 UIKit 0x0000000107891415 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 223
5 SwiftMessages 0x000000010bc42765 _TZFC13SwiftMessages13SwiftMessagesP33_AB28F0CA9BFF0B16E059C4C20EF9AFAA19internalViewFromNibuRxCSo6UIViewrfzT5namedSS6bundleGSqCSo8NSBundle_10filesOwnerPs9AnyObject__x + 1285
6 SwiftMessages 0x000000010bc42fa3 _TZFC13SwiftMessages13SwiftMessages11viewFromNibuRxCSo6UIViewrfzT5namedSS10filesOwnerPs9AnyObject__x + 163
7 SwiftMessages 0x000000010bc2e597 _TZFC13SwiftMessages11MessageView11viewFromNibuRxS0_rfT6layoutOS0_6Layout10filesOwnerPs9AnyObject__x + 151
8 marksix 0x00000001060a340d TFC7marksix31MarkSixCollectionViewController13noticeMessagefTSS5titleSS6statusSb3btnSb_T + 157
9 marksix 0x00000001060a8168 TFC7marksix31MarkSixCollectionViewController9refreshedfT_T + 632
10 marksix 0x00000001060a7acd TFC7marksix31MarkSixCollectionViewController11viewDidLoadfT_T + 477
11 marksix 0x00000001060a7b82 TToFC7marksix31MarkSixCollectionViewController11viewDidLoadfT_T + 34
12 UIKit 0x0000000107661984 -[UIViewController loadViewIfRequired] + 1198
13 UIKit 0x00000001076a5fae -[UINavigationController _layoutViewController:] + 54
14 UIKit 0x00000001076a6882 -[UINavigationController _updateScrollViewFromViewController:toViewController:] + 462
15 UIKit 0x00000001076a69f4 -[UINavigationController _startTransition:fromViewController:toViewController:] + 126
16 UIKit 0x00000001076a7c4d -[UINavigationController _startDeferredTransitionIfNeeded:] + 890
17 UIKit 0x00000001076a8d0b -[UINavigationController __viewWillLayoutSubviews] + 57
18 UIKit 0x0000000107857503 -[UILayoutContainerView layoutSubviews] + 248
19 UIKit 0x0000000107581980 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 703
20 QuartzCore 0x000000010970dc00 -[CALayer layoutSublayers] + 146
21 QuartzCore 0x000000010970208e _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 366
22 QuartzCore 0x0000000109701f0c _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
23 QuartzCore 0x00000001096f63c9 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 277
24 QuartzCore 0x0000000109724086 _ZN2CA11Transaction6commitEv + 486
25 QuartzCore 0x00000001097247f8 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 92
26 CoreFoundation 0x000000010b6a9c37 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION
+ 23
27 CoreFoundation 0x000000010b6a9ba7 __CFRunLoopDoObservers + 391
28 CoreFoundation 0x000000010b69f11c CFRunLoopRunSpecific + 524
29 UIKit 0x00000001074c1f21 -[UIApplication _run] + 402
30 UIKit 0x00000001074c6f09 UIApplicationMain + 171
31 marksix 0x00000001060be902 main + 114
32 libdyld.dylib 0x000000010cbe292d start + 1
33 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)

titleLabel behaviour inconsistent

See following example:

SwiftMessages.show {
    let view = MessageView.viewFromNib(layout: .MessageView)
    view.configureTheme(.info)
    view.titleLabel = nil
    view.configureContent(body: "Some Text!")
    return view
}

Result -> A title with "[Title]" content is shown

SwiftMessages.show {
    let view = MessageView.viewFromNib(layout: .MessageView)
    view.configureTheme(.info)
    view.titleLabel?.text = nil
    view.configureContent(body: "Some Text!")
    return view
}

Result -> No title is shown

SwiftMessage image-error

I got this error and don't know what to do. I made a simple MessageView(like the one in the README.MD) and tried to show it with the SwiftMessages.show(view:myView)-function:

screen shot 2016-10-02 at 14 59 09

screen shot 2016-10-02 at 15 00 46

Weird crash.

Hey. I did some easy things with your library. After user post I popped the message which worked for a while. However, now it leads me to nil and crash. And while debugging, it shows me this. What is causing this?

Error - Could not load the "errorIcon"....

I get this error - Could not load the "errorIcon" image referenced from a nib in the bundle with identifier "(null)"
fatal error: unexpectedly found nil while unwrapping an Optional value

I installed the package with cocoapods.

let error = MessageView.viewFromNib(layout: .TabView)
error.configureTheme(.Error)
error.configureContent(title: "Error", body: "Something is horribly wrong!")
error.button?.setTitle("Stop", forState: .Normal)
SwiftMessages.show(view: error)

image not loaded correctly from real device

The following code works just fine (except for the warning I mentioned on #53) on the simulator

      let config = SwiftMessages.defaultConfig()
        config.presentationStyle = style
        config.dimMode = .gray(interactive: true)
        config.duration = .forever


        
        let view = MessageView.viewFromNib(layout: .CardView )
        view.configureTheme(.info)
        view.configureDropShadow()
        // Hide when message view tapped
        view.tapHandler = { _ in
            SwiftMessages.hide()
        }

        // image with an emoji character.
        let iconText = ":wink:".emojiUnescapedString
        view.configureContent(title: title, body: body, iconImage: nil, iconText: iconText, buttonImage: nil, buttonTitle: "Got it", buttonTapHandler: { _ in
            SwiftMessages.hide()
        })
        SwiftMessages.show(config: config, view: view)

However on the real device it makes the app to crash with this error

Could not load the "errorIcon" image referenced from a nib in the bundle with identifier "org.cocoapods.SwiftMessages"

First of all it's weird is moaning about the error icon when the requested would be the info one
(if any) it seems to ignore that iconImage: nil on the parameters list

Anyway I checked out it's in the assets file and I even have dropped a UIViewController with an image referring that same icon to check it's present within the app assets, I can see the image just fine on the storyboard referring it from the IB but it fails to resolve at runtime, in the simulator or the real device.

Thanks for your time guys

[Feature Request] Observing Pan Gestures from PresenterDelegate

Great library, well documented! Will there eventually be a way to listen in on pan gestures for dismissing the card views? I know SwiftMessages is the PresenterDelegate's delegate, but a callback on completion would be super helpful for analytics/toggling UserDefaults for shown messages :)

Emoji not shown!

Hello.
I have the following code

        let view = MessageView.viewFromNib(layout: .CardView)

        // Theme message elements with the warning style.
        view.configureTheme(.Warning)

        // Add a drop shadow.
        view.configureDropShadow()



        // Set message title, body, and icon. Here, we're overriding the default warning
        // image with an emoji character.
        view.configureContent(title: "How To?", body: "In order to search the Map, click on the Icon up and right!", iconImage: nil, iconText: "๐Ÿ˜Ž", buttonImage: nil, buttonTitle: "OK", buttonTapHandler: { _ in
            self.userDefaults.setBool(true, forKey: "valueHelp")
            self.userDefaults.synchronize()
            SwiftMessages.hide()

        })
        var config = SwiftMessages.Config()

        config.duration = .Forever


        config.dimMode = .Gray(interactive: true)


        config.interactiveHide = false


        SwiftMessages.show(config: config, view: view)

But the emoji is not show on the popup.
Any idea?

iOS 8 support

As I understand from the podspec file, the minimum required OS is iOS 8. However, the use of UIStackView in the codebase causes a crash on iOS 8, while working fine on iOS 9. Should I assume the minimum requirement is actually iOS 9?

Crash on calling configureTheme

Hey,

I recently saw a crash on Crashlytics, which happens when we call configureTheme method. The logs are pasted below.

The OS is 9.3.3 and the device is iPhone6

`Crashed: com.apple.main-thread
0 SwiftMessages 0x100f08ff4 _TFO13SwiftMessages9IconStyle5imagefT5themeOS_5Theme_CSo7UIImage + 1864

1 SwiftMessages 0x100ef24c4 TFC13SwiftMessages11MessageView14configureThemefTOS_5Theme9iconStyleOS_9IconStyle_T + 28

2 0x1004815a4 specialized static PPNotificationsController.showInAppCustomNotificationWith(title : String, body : String, userInfo : [AnyHashable : Any]?, onTapCompletion : ([AnyHashable : Any]) -> ()?) -> () (PPNotificationsController.swift:223)

3 0x100481fcc specialized static PPNotificationsController.showLocalNotificationWith(title : String, body : String, badge : Int?, userInfo : [AnyHashable : Any], identifier : String?, application : UIApplication, onTapCompletion : ([AnyHashable : Any]) -> ()?) -> () (PPNotificationsController.swift)

4 0x100482b30 specialized PPNotificationsController.didReceiveRemoteNotification(with : [AnyHashable : Any], principalController : PPPrincipalController, application : UIApplication, onTapCompletion : ([AnyHashable : Any]) -> ()?) -> () (PPNotificationsController.swift)

5 0x100455d5c specialized AppDelegate.application(UIApplication, didReceiveRemoteNotification : [AnyHashable : Any], fetchCompletionHandler : (UIBackgroundFetchResult) -> ()) -> () (AppDelegate.swift)

6 0x1004504a4 @objc AppDelegate.application(UIApplication, didReceiveRemoteNotification : [AnyHashable : Any], fetchCompletionHandler : (UIBackgroundFetchResult) -> ()) -> () (AppDelegate.swift)

7 UIKit 0x1893ee1a8 -[UIApplication _handleNonLaunchSpecificActions:forScene:withTransitionContext:completion:] + 2676

8 UIKit 0x1893dbf84 -[UIApplication workspace:didReceiveActions:] + 136

9 FrontBoardServices 0x1859777ac FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK + 36

10 FrontBoardServices 0x185977618 -[FBSSerialQueue _performNext] + 168

11 FrontBoardServices 0x1859779c8 -[FBSSerialQueue _performNextFromRunLoopSource] + 56

12 CoreFoundation 0x183f8d09c CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 24

13 CoreFoundation 0x183f8cb30 __CFRunLoopDoSources0 + 540

14 CoreFoundation 0x183f8a830 __CFRunLoopRun + 724

15 CoreFoundation 0x183eb4c50 CFRunLoopRunSpecific + 384

16 GraphicsServices 0x18579c088 GSEventRunModal + 180

17 UIKit 0x18919e088 UIApplicationMain + 204

18 App 0x1000beff0 main (AppDelegate.swift:15)

19 libdyld.dylib 0x183a528b8 start + 4`

This is how i'm using SwiftMessages

static func showInAppCustomNotificationWith(title: String, body: String, userInfo: [AnyHashable: Any]?, onTapCompletion: (([AnyHashable: Any]) -> Void)? = nil) {

    `//Show SwiftMessages view here
    
    let view: MessageView
    
    if #available(iOS 9.0, *) {
        view = MessageView.viewFromNib(layout: .CardView)
    } else {
        view = MessageView.viewFromNib(layout: .MessageViewIOS8)
    }        
    
    view.button?.isHidden = true
    view.configureTheme(.info)
    view.iconImageView?.image = UIImage(named: "ic_stat_notify_large")
    view.configureDropShadow()
    view.bodyLabel?.numberOfLines = 2
    view.configureContent(title: title, body: body)
    
    var config = SwiftMessages.Config()
    
    config.presentationContext = .window(windowLevel: UIWindowLevelStatusBar)
    config.presentationStyle = .top
    config.duration = .seconds(seconds: 4)
    
    view.tapHandler = { _ in
        
        if let userInfo = userInfo {
            onTapCompletion?(userInfo)
        }
        
    }
    
    SwiftMessages.show(config: config, view: view)
    
}`

Any ideas as to why this might be happening?
Any help is greatly appreciated.

Setting Theme from Remote Push Notification

I need to set the theme of the message using a string being sent through a remote push notification. Unfortunately, when I am trying to set it I get this error:

Could not cast value of type 'NSTaggedPointerString' (0x102990630) to 'SwiftMessages.Theme'

Any ideas how I can get this to work? Here is my code:

func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any]) {
    let notification = userInfo["aps"] as! [String: AnyObject]

    if (notification["content-available"] as? NSString)?.integerValue == 1 {
        // Silent
    } else {
        // Audible
        if (application.applicationState == UIApplicationState.active) {
            let view = MessageView.viewFromNib(layout: .MessageViewIOS8)
            view.configureTheme(notification["type"] as! Theme)
            view.configureDropShadow()
            view.configureContent(title: notification["title"] as! String, body: notification["alert"] as! String)
            SwiftMessages.show(view: view)
        } else {

        }
    }
}

button is shown although set to nil

See following example:

SwiftMessages.show {
    let view = MessageView.viewFromNib(layout: .MessageView)
    view.configureTheme(.info)
    view.button = nil            
    view.configureContent(title: "", body: "Some Text!")
    return view
}

Result -> button is there although it should be nil

Prevent close when tapped?

Hi,

Thanks for the great control.

Is there any way to prevent closure when tapping it? I want to only be able to hide it programmatically.

crash on iOS 10 when built using Swift 2.2 - Xcode 7.3.1

Here is the stack. The screen was frozen for a while and then crashed. I am using .TabView

#0. Crashed: com.apple.main-thread
0 libsystem_kernel.dylib 0x1853da014 __pthread_kill + 8
1 libsystem_pthread.dylib 0x1854a2450 pthread_kill + 112
2 libsystem_c.dylib 0x18534e3e0 abort + 140
3 libsystem_malloc.dylib 0x18541ea38 _nano_vet_and_size_of_live + 330
4 libsystem_malloc.dylib 0x18541fdb8 nano_free + 220
5 CoreFoundation 0x1863b9e8c _CFRelease + 1264
6 UIKit 0x18c2ae340 -[UIBezierPath _initWithCGMutablePath:] + 64
7 UIKit 0x18c51f334 +[UIBezierPath _continuousRoundedRectBezierPath:withRoundedCorners:cornerRadii:segments:smoothPillShapes:] + 2036
8 UIKit 0x18c2ae9f4 +[UIBezierPath _continuousRoundedRectBezierPath:withRoundedCorners:cornerRadius:segments:] + 212
9 UIKit 0x18c2ae584 +[UIBezierPath _roundedRectBezierPath:withRoundedCorners:cornerRadius:segments:legacyCorners:] + 352
10 SwiftMessages 0x103f7942c TFC13SwiftMessages8BaseView14layoutSubviewsfT_T + 284
11 SwiftMessages 0x103f794e4 TToFC13SwiftMessages8BaseView14layoutSubviewsfT_T + 28
12 UIKit 0x18c262220 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1196
13 QuartzCore 0x189722188 -[CALayer layoutSublayers] + 148
14 QuartzCore 0x189716e64 CA::Layer::layout_if_needed(CA::Transaction*) + 292
15 UIKit 0x18c276c90 -[UIView(Hierarchy) layoutBelowIfNeeded] + 1020
16 SwiftMessages 0x103f821a8 TFC13SwiftMessages9Presenter7installfT_T + 3596
17 SwiftMessages 0x103f80c68 TFC13SwiftMessages9Presenter4showfzT10completionFT9completedSb_T__T + 672
18 SwiftMessages 0x103f8bd94 TFFC13SwiftMessages13SwiftMessages11dequeueNextFT_T_U_FT_T + 156
19 libdispatch.dylib 0x185295200 _dispatch_call_block_and_release + 24
20 libdispatch.dylib 0x1852951c0 _dispatch_client_callout + 16
21 libdispatch.dylib 0x185299d6c _dispatch_main_queue_callback_4CF + 1000
22 CoreFoundation 0x1863b7f2c CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 12
23 CoreFoundation 0x1863b5b18 __CFRunLoopRun + 1660
24 CoreFoundation 0x1862e4048 CFRunLoopRunSpecific + 444
25 GraphicsServices 0x187d6a198 GSEventRunModal + 180
26 UIKit 0x18c2d02fc -[UIApplication _run] + 684
27 UIKit 0x18c2cb034 UIApplicationMain + 208

There is no way to create SwiftMessages instance as there is no public initializer

Sometimes you need to separate queues for different messages and make default configuration for them. Currently you can't do that as there is only one instance of SwiftMessages with own queue.
For example I want to show StatusLine when user is offline but when it's shown I can't show other messages.

Just add this to SwiftMessages
public init() { }

Default title visible although not set [maybe no bug]

See following example:

SwiftMessages.show {
    let view = MessageView.viewFromNib(layout: .MessageView)
    view.configureTheme(.info)      
    view.configureContent(body: "Some Text!")
    return view
}

Result -> Default title ("[Title]") is shown

iOS 8 support is break

Some xib used UIStackView which is added in iOS 9.0.
I see a MessageViewIOS8.xib, but it's layout is not the same as MessageView.xib.

First responder issue

I'm currently using SwiftMessages 2.0.
In a chat view, I'm displaying messages notifications while the user is typing text.
When a message comes-in it is granted to be the new first responder which makes the keyboard disappear in consequence.
Do you have any workaround ideas ?

Thanks

Naming

Hello

Please add Prefix to all files, nibs etc. I got situation when I add xib with name CardView, your bundle also has xib named CardView, so function

fileprivate class func internalViewFromNib<T: UIView>(named name: String, bundle: Bundle? = nil, filesOwner: AnyObject = NSNull.init()) throws -> T {

incorrectly select bundle for getting view CardView and I got crash.
I guess adding prefix as recommended by Apple "XYZ" will prevent similar problems

Or better instead of

         if Bundle.main.path(forResource: name, ofType: "nib") != nil {
            resolvedBundle = Bundle.main
        } else {
            resolvedBundle = Bundle.sm_frameworkBundle()
        }

use just

        resolvedBundle = Bundle.sm_frameworkBundle()

Thanks

Message not showing some times

Hello

Bellow two issue which i have.

  1. Some times message is not showing
  2. Message hides my accessory view( Bottom tool bar)

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.