Giter VIP home page Giter VIP logo

wjshare's Introduction

WJShare

本人在做ios开发的时候通常都会遇见一个需求那就是要求实现分享功能虽然不需要所有的社交平台但是基本的社交平台还是需要的比如说QQ、微信、微博等这些都是基本的要求。于是在我们便要去各个平台的开发者中心下载sdk然后集成到自己的app中,有时候就连SDK都会比我们的App都要大。 然而在用oc开发iOS的时候还有OpenShare可以使用,但是最近swift的发展迅速。本人也在用swift开发公司项目的时候,要求实现分享功能同时老大也要求不要使用SDK于是本人硬着头皮就研究了OpenShare终于完成了swift版本的OpenShare。由于swift和oc的语法相差比较大所以使用的方式也是不太一样,另有不足之处还请多多指出

功能

当前版本只实现了比较简单的功能:

  • QQ空间和QQ好友的文本分享,图片分享和链接分享
  • 微信朋友圈的分享文本分享,图片分享和链接分享
  • 微博的分享文本分享,图片分享和链接分享

当然更加多的功能会在后续中添加

如何使用

在将文件添加到你的项目中后,就可以使用了:

链接appID

使用shareManager的类方法

class func connectWithWeiboAppID(appid:String) //链接微博的appid
class func connectWithQQAppID(appid:String) //链接QQ的appID
class func connectWithWechatAppID(appid:String) //链接微信的appID

运行后在控制台得到提示:

image

添加Scheme URL

将从控制台得到的URL添加到项目的info.plist中

image

分享

构造Message

sm = ShareMessage(messageType: MessageType.Link, title: "测试") //消息的title
sm.messageImage = NSData(data:  UIImagePNGRepresentation(UIImage(named: "logo-2"))) //消息的图片
sm.messageDesc = "image Description" //消息的描述
sm.messageLink = "http://www.baidu.com" //链接消息时的链接

调用方法进行分享

let shareQQ = ShareManagerQQ()
shareQQ.shareToQQZoneWithMessage(sm) { (dic :Dictionary<String, String>, error :NSError?) -> Void in
    NSLog("\(dic)")
}

wjshare's People

Contributors

jasonwww avatar jasonwugit avatar

Stargazers

beforeold avatar iAppleBoy avatar Aaron ttgb avatar  avatar

Watchers

 avatar

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.